/*
 * Copyright (c) 2025, 2025, Oracle and/or its affiliates. All rights reserved.
 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
 *
 * The Universal Permissive License (UPL), Version 1.0
 *
 * Subject to the condition set forth below, permission is hereby granted to any
 * person obtaining a copy of this software, associated documentation and/or
 * data (collectively the "Software"), free of charge and under any and all
 * copyright rights in the Software, and any and all patent rights owned or
 * freely licensable by each licensor hereunder covering either (i) the
 * unmodified Software as contributed to or provided by such licensor, or (ii)
 * the Larger Works (as defined below), to deal in both
 *
 * (a) the Software, and
 *
 * (b) any piece of software and/or hardware listed in the lrgrwrks.txt file if
 * one is included with the Software each a "Larger Work" to which the Software
 * is contributed by such licensors),
 *
 * without restriction, including without limitation the rights to copy, create
 * derivative works of, display, perform, and distribute the Software and make,
 * use, sell, offer for sale, import, export, have made, and have sold the
 * Software and the Larger Work(s), and to sublicense the foregoing rights on
 * either these or other terms.
 *
 * This license is subject to the following condition:
 *
 * The above copyright notice and either this complete permission notice or at a
 * minimum a reference to the UPL must be included in all copies or substantial
 * portions of the Software.
 *
 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
 * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
 * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
 * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
 * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
 * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
 * SOFTWARE.
 */
package com.oracle.truffle.regex.tregex.test.generated;

import static com.oracle.truffle.regex.tregex.string.Encoding.UTF_8;
import static com.oracle.truffle.regex.tregex.test.generated.TestCase.match;
import static com.oracle.truffle.regex.tregex.test.generated.TestCase.noMatch;
import static com.oracle.truffle.regex.tregex.test.generated.TestCase.syntaxError;
import static com.oracle.truffle.regex.tregex.test.generated.TestCase.testCase;

import com.oracle.truffle.regex.RegexSyntaxException.ErrorCode;

public class OracleDBGeneratedTests {

    public static final TestCase[] TESTS = {
        // @formatter:off
        // Checkstyle: stop LineLength
        /* GENERATED CODE BEGIN - KEEP THIS MARKER FOR AUTOMATIC UPDATES */

        testCase("\\0", "", UTF_8, match("\\0", 0, 1, 2)),
        testCase("\\b", "", UTF_8, match("\\b", 0, 1, 2)),
        testCase("\\B", "", UTF_8, match("\\B", 0, 1, 2)),
        testCase("\\f", "", UTF_8, match("\\f", 0, 1, 2)),
        testCase("\\n", "", UTF_8, match("\\n", 0, 1, 2)),
        testCase("\\r", "", UTF_8, match("\\r", 0, 1, 2)),
        testCase("\\t", "", UTF_8, match("\\t", 0, 1, 2)),
        testCase("\\v", "", UTF_8, match("\\v", 0, 1, 2)),
        testCase("\\x", "", UTF_8, match("\\x", 0, 1, 2)),
        testCase("\\u", "", UTF_8, match("\\u", 0, 1, 2)),
        testCase("\\p", "", UTF_8, match("\\p", 0, 1, 2)),
        testCase("\\P", "", UTF_8, match("\\P", 0, 1, 2)),
        testCase("(:)", "", UTF_8, match(":", 0, 0, 1, 0, 1)),
        testCase("(?:)", "", UTF_8, match("?:", 0, 1, 2, 1, 2)),
        testCase("(=)", "", UTF_8, match("=", 0, 0, 1, 0, 1)),
        testCase("(?=)", "", UTF_8, match("?=", 0, 1, 2, 1, 2)),
        testCase("(!)", "", UTF_8, match("!", 0, 0, 1, 0, 1)),
        testCase("(?!)", "", UTF_8, match("?!", 0, 1, 2, 1, 2)),
        testCase("(<=)", "", UTF_8, match("<=", 0, 0, 2, 0, 2)),
        testCase("(?<=)", "", UTF_8, match("?<=", 0, 1, 3, 1, 3)),
        testCase("(<!)", "", UTF_8, match("<!", 0, 0, 2, 0, 2)),
        testCase("(?<!)", "", UTF_8, match("?<!", 0, 1, 3, 1, 3)),
        testCase("(<a>)", "", UTF_8, match("<a>", 0, 0, 3, 0, 3)),
        testCase("(?<a>)", "", UTF_8, match("?<a>", 0, 1, 4, 1, 4)),
        testCase("(P<a>)", "", UTF_8, match("P<a>", 0, 0, 4, 0, 4)),
        testCase("(?P<a>)", "", UTF_8, match("?P<a>", 0, 1, 5, 1, 5)),
        testCase("(P=a)", "", UTF_8, match("P=a", 0, 0, 3, 0, 3)),
        testCase("(?P=a)", "", UTF_8, match("?P=a", 0, 1, 4, 1, 4)),
        testCase("\\Ax", "", UTF_8, noMatch("yx", 0)),
        testCase("\\s\\Z", "", UTF_8,
            match("x \n", 0, 1, 2),
            match("x \n", 2, 2, 3),
            match("x \n \n", 0, 3, 4)),
        testCase("\\s\\Z", "m", UTF_8, match("x \n \n", 0, 3, 4)),
        testCase("\\s$", "", UTF_8,
            match("x \n", 0, 1, 2),
            match("x \n", 2, 2, 3),
            match("x \n \n", 0, 3, 4)),
        testCase("\\s$", "m", UTF_8, match("x \n \n", 0, 1, 2)),
        testCase("\\s\\z", "", UTF_8,
            match("x \n", 0, 2, 3),
            match("x \n", 2, 2, 3),
            match("x \n \n", 0, 4, 5)),
        testCase("\\s\\z", "m", UTF_8, match("x \n \n", 0, 4, 5)),
        testCase("}", "", UTF_8, match("}", 0, 0, 1)),
        testCase("{", "", UTF_8, match("{", 0, 0, 1)),
        testCase("]", "", UTF_8, match("]", 0, 0, 1)),
        testCase("[", "", UTF_8, syntaxError(ErrorCode.UnmatchedBracket)),
        testCase(")", "", UTF_8, syntaxError(ErrorCode.UnmatchedParenthesis)),
        testCase("x{,1}", "", UTF_8,
            noMatch("x", 0),
            match("x{,1}", 0, 0, 5)),
        testCase("x{,1}?", "", UTF_8,
            noMatch("x", 0),
            match("x{,1}", 0, 0, 5),
            match("x{,1", 0, 0, 4)),
        testCase("x{1,}", "", UTF_8, match("x{1,}", 0, 0, 1)),
        testCase("x{2,1}", "", UTF_8, syntaxError(ErrorCode.InvalidQuantifier)),
        testCase("x{2147483649}", "", UTF_8, syntaxError(ErrorCode.InvalidQuantifier)),
        testCase("x{2147483649,}", "", UTF_8, syntaxError(ErrorCode.InvalidQuantifier)),
        testCase("x{2147483649,2}", "", UTF_8, syntaxError(ErrorCode.InvalidQuantifier)),
        testCase("x{2147483649,2147483650}", "", UTF_8, syntaxError(ErrorCode.InvalidQuantifier)),
        testCase("x{0,4294967295}", "", UTF_8, syntaxError(ErrorCode.InvalidQuantifier)),
        testCase("x{1,4294967295}", "", UTF_8, syntaxError(ErrorCode.InvalidQuantifier)),
        testCase("x{2147483648,4294967295}", "", UTF_8, syntaxError(ErrorCode.InvalidQuantifier)),
        testCase("x{1,2147483648}", "", UTF_8, syntaxError(ErrorCode.InvalidQuantifier)),
        testCase("x{2,2147483648}", "", UTF_8, syntaxError(ErrorCode.InvalidQuantifier)),
        testCase("x{2,2147483649}", "", UTF_8, syntaxError(ErrorCode.InvalidQuantifier)),
        testCase("x{4294967296}", "", UTF_8, syntaxError(ErrorCode.InvalidQuantifier)),
        testCase("x{4294967297}", "", UTF_8, syntaxError(ErrorCode.InvalidQuantifier)),
        testCase("x??", "", UTF_8, match("x", 0, 0, 0)),
        testCase("\\A*x\\Z+", "", UTF_8,
            match("x", 0, 0, 1),
            match("xx", 0, 1, 2)),
        testCase("\\A+x\\Z+", "", UTF_8, noMatch("xx", 0)),
        testCase("x{2}?", "", UTF_8, match("xxxxx", 0, 0, 2)),
        testCase("(a{0,1})*b\\1", "", UTF_8,
            match("aab", 0, 0, 3, 2, 2),
            match("aaba", 0, 0, 3, 2, 2),
            match("aabaa", 0, 0, 3, 2, 2),
            match("ab", 0, 0, 2, 1, 1),
            match("aba", 0, 0, 2, 1, 1),
            match("abaa", 0, 0, 2, 1, 1)),
        testCase("[]]", "", UTF_8,
            match("]", 0, 0, 1),
            match("[]", 0, 1, 2)),
        testCase("[][]+", "", UTF_8, match("[]", 0, 0, 2)),
        testCase("[]", "", UTF_8, syntaxError(ErrorCode.UnmatchedBracket)),
        testCase("[b-a]", "", UTF_8, syntaxError(ErrorCode.InvalidCharacterClass)),
        testCase("[-a]", "", UTF_8, match("-a", 0, 0, 1)),
        testCase("[a-]", "", UTF_8, match("-a", 0, 0, 1)),
        testCase("[[ab]]", "", UTF_8,
            match("[]ab]", 0, 0, 2),
            match("[]ab]", 1, 3, 5)),
        testCase("[[::]]", "", UTF_8,
            match("[]:", 0, 0, 1),
            match("[]:", 1, 1, 2),
            match("[]:", 2, 2, 3)),
        testCase("[[:ab:]]", "", UTF_8, syntaxError(ErrorCode.InvalidCharacterClass)),
        testCase("[[:upper:]]+", "", UTF_8,
            noMatch(":upper:", 0),
            match(":UPPER:", 0, 1, 6),
            match("@AZ[", 0, 1, 3)),
        testCase("[:upper:]+", "", UTF_8, match(":upper:", 0, 0, 7)),
        testCase("[[:lower:]]+", "", UTF_8,
            noMatch(":LOWER:", 0),
            match(":lower:", 0, 1, 6),
            match("`az{", 0, 1, 3)),
        testCase("[:lower:]+", "", UTF_8, match(":lower:", 0, 0, 7)),
        testCase("[x[ab]y]", "", UTF_8, match("ay]", 0, 0, 3)),
        testCase("[a\\]+", "", UTF_8, match("a\\", 0, 0, 2)),
        testCase("[\\a]+", "", UTF_8, match("a\\", 0, 0, 2)),
        testCase("[[:lower:]-[:upper:]]+", "", UTF_8, match("a-A", 0, 0, 3)),
        testCase("[a-z]+", "", UTF_8, match("abc-", 0, 0, 3)),
        testCase("[[.a.]-[.z.]]+", "", UTF_8, match("abc-", 0, 0, 3)),
        testCase("[[=a=]-[=z=]]+", "", UTF_8, match("abc-", 0, 0, 3)),
        testCase("[[.a.]-[=z=]]+", "", UTF_8, match("abc-", 0, 0, 3)),
        testCase("[[=a=]-[.z.]]+", "", UTF_8, match("abc-", 0, 0, 3)),
        testCase("[[.a.]-[.ch.]]+", "", UTF_8, syntaxError(ErrorCode.InvalidCharacterClass)),
        testCase("[[.a.]-[:lower:]]+", "", UTF_8, syntaxError(ErrorCode.InvalidCharacterClass)),
        testCase("[[=a=]-[:lower:]]+", "", UTF_8, syntaxError(ErrorCode.InvalidCharacterClass)),
        testCase("[[:upper:]-[.a.]]+", "", UTF_8, match("a-A", 0, 0, 3)),
        testCase("[[=c=]-c]", "", UTF_8, match("\u010d-=c", 0, 4, 5)),
        testCase("[[=c=]-]+", "", UTF_8, match("\u010d-=c", 0, 0, 3)),
        testCase("(\\2())", "", UTF_8, syntaxError(ErrorCode.InvalidBackReference)),
        testCase("(\\1a)", "", UTF_8, noMatch("aa", 0)),
        testCase("(\\1a|){2}", "", UTF_8, match("aa", 0, 0, 0, 0, 0)),
        testCase("(\\1a|)*", "", UTF_8, match("aa", 0, 0, 0, 0, 0)),
        testCase("(()b|\\2a){2}", "", UTF_8, match("ba", 0, 0, 2, 1, 2, 0, 0)),
        testCase("(a\\1)", "", UTF_8, noMatch("aa", 0)),
        testCase("(a|b\\1){2}", "", UTF_8, match("aba", 0, 0, 3, 1, 3)),
        testCase("(a|(b\\1)){2}", "", UTF_8, match("aba", 0, 0, 3, 1, 3, 1, 3)),
        testCase("((a)|b\\1){2}", "", UTF_8, match("aba", 0, 0, 3, 1, 3, 0, 1)),
        testCase("((a|b\\1)){2}", "", UTF_8, match("aba", 0, 0, 3, 1, 3, 1, 3)),
        testCase("((a|b\\2)){2}", "", UTF_8, match("aba", 0, 0, 3, 1, 3, 1, 3)),
        testCase("((a)|b\\2){2}", "", UTF_8, match("aba", 0, 0, 3, 1, 3, 0, 1)),
        testCase("((a)|b\\2)*", "", UTF_8, match("aba", 0, 0, 3, 1, 3, 0, 1)),
        testCase("(a|b\\1*){2}", "", UTF_8, match("abaaaa", 0, 0, 6, 1, 6)),
        testCase("^(a|\\1b)+$", "", UTF_8, noMatch("ab", 0)),
        testCase("(a)\\10", "", UTF_8, match("aa0", 0, 0, 3, 0, 1)),
        testCase("(a)\\100", "", UTF_8, match("aa00", 0, 0, 4, 0, 1)),
        testCase("a a", "x", UTF_8, match("aa", 0, 0, 2)),
        testCase("a\na", "x", UTF_8, match("aa", 0, 0, 2)),
        testCase("a\u0009a", "x", UTF_8, noMatch("aa", 0)),
        testCase("a\u000ba", "x", UTF_8, noMatch("aa", 0)),
        testCase("a\u000ca", "x", UTF_8, noMatch("aa", 0)),
        testCase("a\ra", "x", UTF_8, noMatch("aa", 0)),
        testCase("\\", "", UTF_8, match("aa", 0, 0, 0)),
        testCase("\\077", "", UTF_8,
            noMatch("?", 0),
            match("077", 0, 0, 3)),
        testCase("\\x61", "", UTF_8,
            noMatch("a", 0),
            match("x61", 0, 0, 3)),
        testCase("\\u0061", "", UTF_8,
            noMatch("a", 0),
            match("u0061", 0, 0, 5)),
        testCase("(a*|b)*", "", UTF_8,
            match("aaaaaabaaaaaaaaaaaaaabb", 0, 0, 6, 6, 6),
            match("-", 0, 0, 0, 0, 0)),
        testCase("a((b?)*)*", "", UTF_8, match("ab", 0, 0, 2, 2, 2, 2, 2)),
        testCase("(()|()|a)+b", "", UTF_8, match("ab", 0, 0, 2, 1, 1, 1, 1, -1, -1)),
        testCase("a(\\z|())", "", UTF_8, match("a", 0, 0, 1, 1, 1, -1, -1)),
        testCase("abracadabra$", "", UTF_8, match("abracadabracadabra", 0, 7, 18)),
        testCase("a...b", "", UTF_8, match("abababbb", 0, 2, 7)),
        testCase("XXXXXX", "", UTF_8, match("..XXXXXX", 0, 2, 8)),
        testCase("\\)", "", UTF_8, match("()", 0, 1, 2)),
        testCase("a]", "", UTF_8,
            match("a]a", 0, 0, 2),
            match("a]", 0, 0, 2)),
        testCase("\\}", "", UTF_8, match("}", 0, 0, 1)),
        testCase("\\]", "", UTF_8, match("]", 0, 0, 1)),
        testCase("^a", "", UTF_8, match("ax", 0, 0, 1)),
        testCase("\\^a", "", UTF_8, match("a^a", 0, 1, 3)),
        testCase("a\\^", "", UTF_8, match("a^", 0, 0, 2)),
        testCase("a$", "", UTF_8,
            match("aa", 0, 1, 2),
            match("a", 0, 0, 1),
            noMatch("\n", 0),
            match("a\n", 0, 0, 1)),
        testCase("a\\$", "", UTF_8, match("a$", 0, 0, 2)),
        testCase("a($)", "", UTF_8, match("aa", 0, 1, 2, 2, 2)),
        testCase("a*(^a)", "", UTF_8, match("aa", 0, 0, 1, 0, 1)),
        testCase("(..)*(...)*", "", UTF_8,
            match("a", 0, 0, 0, -1, -1, -1, -1),
            match("abcd", 0, 0, 4, 2, 4, -1, -1)),
        testCase("(ab|a)(bc|c)", "", UTF_8, match("abc", 0, 0, 3, 0, 2, 2, 3)),
        testCase("(ab)c|abc", "", UTF_8, match("abc", 0, 0, 3, 0, 2)),
        testCase("a{0}b", "", UTF_8, match("ab", 0, 1, 2)),
        testCase("(a*)(b?)(b+)b{3}", "", UTF_8, match("aaabbbbbbb", 0, 0, 10, 0, 3, 3, 4, 4, 7)),
        testCase("(a*)(b{0,1})(b{1,})b{3}", "", UTF_8, match("aaabbbbbbb", 0, 0, 10, 0, 3, 3, 4, 4, 7)),
        testCase("a{9876543210}", "", UTF_8, syntaxError(ErrorCode.InvalidQuantifier)),
        testCase("((a|a)|a)", "", UTF_8, match("a", 0, 0, 1, 0, 1, 0, 1)),
        testCase("(a*)(a|aa)", "", UTF_8, match("aaaa", 0, 0, 4, 0, 3, 3, 4)),
        testCase("a*(a.|aa)", "", UTF_8, match("aaaa", 0, 0, 4, 2, 4)),
        testCase("a(b)|c(d)|a(e)f", "", UTF_8, match("aef", 0, 0, 3, -1, -1, -1, -1, 1, 2)),
        testCase("(a|b)?.*", "", UTF_8, match("b", 0, 0, 1, 0, 1)),
        testCase("(a|b)c|a(b|c)", "", UTF_8,
            match("ac", 0, 0, 2, 0, 1, -1, -1),
            match("ab", 0, 0, 2, -1, -1, 1, 2)),
        testCase("(a|b)*c|(a|ab)*c", "", UTF_8,
            match("abc", 0, 0, 3, 1, 2, -1, -1),
            match("xc", 0, 1, 2, -1, -1, -1, -1)),
        testCase("(.a|.b).*|.*(.a|.b)", "", UTF_8, match("xa", 0, 0, 2, 0, 2, -1, -1)),
        testCase("a?(ab|ba)ab", "", UTF_8, match("abab", 0, 0, 4, 0, 2)),
        testCase("a?(ac{0}b|ba)ab", "", UTF_8, match("abab", 0, 0, 4, 0, 2)),
        testCase("ab|abab", "", UTF_8, match("abbabab", 0, 0, 2)),
        testCase("aba|bab|bba", "", UTF_8, match("baaabbbaba", 0, 5, 8)),
        testCase("aba|bab", "", UTF_8, match("baaabbbaba", 0, 6, 9)),
        testCase("(aa|aaa)*|(a|aaaaa)", "", UTF_8, match("aa", 0, 0, 2, 0, 2, -1, -1)),
        testCase("(a.|.a.)*|(a|.a...)", "", UTF_8, match("aa", 0, 0, 2, 0, 2, -1, -1)),
        testCase("ab|a", "", UTF_8,
            match("xabc", 0, 1, 3),
            match("xxabc", 0, 2, 4)),
        testCase("(Ab|cD)*", "", UTF_8, match("aBcD", 0, 0, 0, -1, -1)),
        testCase("[^-]", "", UTF_8, match("--a", 0, 2, 3)),
        testCase("[a-]*", "", UTF_8, match("--a", 0, 0, 3)),
        testCase("[a-m-]*", "", UTF_8, match("--amoma--", 0, 0, 4)),
        testCase(":::1:::0:|:::1:1:0:", "", UTF_8, match(":::0:::1:::1:::0:", 0, 8, 17)),
        testCase(":::1:::0:|:::1:1:1:", "", UTF_8, match(":::0:::1:::1:::0:", 0, 8, 17)),
        testCase("[[:upper:]]", "", UTF_8, match("A", 0, 0, 1)),
        testCase("[[-]]", "", UTF_8, match("[[-]]", 0, 2, 4)),
        testCase("\\n", "", UTF_8, match("\\n", 0, 1, 2)),
        testCase("[^a]", "", UTF_8, match("\\n", 0, 0, 1)),
        testCase("\\na", "", UTF_8, match("\\na", 0, 1, 3)),
        testCase("(a)(b)(c)", "", UTF_8, match("abc", 0, 0, 3, 0, 1, 1, 2, 2, 3)),
        testCase("xxx", "", UTF_8, match("xxx", 0, 0, 3)),
        testCase("(^|[ (,;])((([Ff]eb[^ ]* *|0*2/|\\* */?)0*[6-7]))([^0-9]|$)", "", UTF_8,
            match("feb 6,", 0, 0, 6, 0, 0, 0, 5, 0, 5, 0, 4, 5, 6),
            match("2/7", 0, 0, 3, 0, 0, 0, 3, 0, 3, 0, 2, 3, 3),
            match("feb 1,Feb 6", 0, 5, 11, 5, 6, 6, 11, 6, 11, 6, 10, 11, 11)),
        testCase("((((((((((((((((((((((((((((((x))))))))))))))))))))))))))))))", "", UTF_8, match("x", 0, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1)),
        testCase("((((((((((((((((((((((((((((((x))))))))))))))))))))))))))))))*", "", UTF_8, match("xx", 0, 0, 2, 1, 2, 1, 2, 1, 2, 1, 2, 1, 2, 1, 2, 1, 2, 1, 2, 1, 2)),
        testCase("a?(ab|ba)*", "", UTF_8, match("ababababababababababababababababababababababababababababababababababababababababa", 0, 0, 81, 79, 81)),
        testCase("abaa|abbaa|abbbaa|abbbbaa", "", UTF_8,
            match("ababbabbbabbbabbbbabbbbaa", 0, 18, 25),
            match("ababbabbbabbbabbbbabaa", 0, 18, 22)),
        testCase("aaac|aabc|abac|abbc|baac|babc|bbac|bbbc", "", UTF_8, match("baaabbbabac", 0, 7, 11)),
        testCase(".*", "", UTF_8, match("\\x01\\xff", 0, 0, 8)),
        testCase("aaaa|bbbb|cccc|ddddd|eeeeee|fffffff|gggg|hhhh|iiiii|jjjjj|kkkkk|llll", "", UTF_8, match("XaaaXbbbXcccXdddXeeeXfffXgggXhhhXiiiXjjjXkkkXlllXcbaXaaaa", 0, 53, 57)),
        testCase("aaaa\\nbbbb\\ncccc\\nddddd\\neeeeee\\nfffffff\\ngggg\\nhhhh\\niiiii\\njjjjj\\nkkkkk\\nllll", "", UTF_8, noMatch("XaaaXbbbXcccXdddXeeeXfffXgggXhhhXiiiXjjjXkkkXlllXcbaXaaaa", 0)),
        testCase("a*a*a*a*a*b", "", UTF_8, match("aaaaaaaaab", 0, 0, 10)),
        testCase("^", "", UTF_8,
            match("a", 0, 0, 0),
            match("abc", 0, 0, 0)),
        testCase("$", "", UTF_8,
            match("a", 0, 1, 1),
            match("abc", 0, 3, 3),
            match("\n", 0, 0, 0),
            match("a\n", 0, 1, 1)),
        testCase("^$", "", UTF_8, noMatch("a", 0)),
        testCase("^a$", "", UTF_8, match("a", 0, 0, 1)),
        testCase("abc", "", UTF_8,
            match("abc", 0, 0, 3),
            match("xabcy", 0, 1, 4),
            match("ababc", 0, 2, 5)),
        testCase("ab*c", "", UTF_8, match("abc", 0, 0, 3)),
        testCase("ab*bc", "", UTF_8,
            match("abc", 0, 0, 3),
            match("abbc", 0, 0, 4),
            match("abbbbc", 0, 0, 6)),
        testCase("ab+bc", "", UTF_8,
            match("abbc", 0, 0, 4),
            match("abbbbc", 0, 0, 6)),
        testCase("ab?bc", "", UTF_8,
            match("abbc", 0, 0, 4),
            match("abc", 0, 0, 3)),
        testCase("ab?c", "", UTF_8, match("abc", 0, 0, 3)),
        testCase("^abc$", "", UTF_8, match("abc", 0, 0, 3)),
        testCase("^abc", "", UTF_8, match("abcc", 0, 0, 3)),
        testCase("abc$", "", UTF_8, match("aabc", 0, 1, 4)),
        testCase("a.c", "", UTF_8,
            match("abc", 0, 0, 3),
            match("axc", 0, 0, 3)),
        testCase("a.*c", "", UTF_8, match("axyzc", 0, 0, 5)),
        testCase("a[bc]d", "", UTF_8, match("abd", 0, 0, 3)),
        testCase("a[b-d]e", "", UTF_8, match("ace", 0, 0, 3)),
        testCase("a[b-d]", "", UTF_8, match("aac", 0, 1, 3)),
        testCase("a[-b]", "", UTF_8, match("a-", 0, 0, 2)),
        testCase("a[b-]", "", UTF_8, match("a-", 0, 0, 2)),
        testCase("a[]]b", "", UTF_8, match("a]b", 0, 0, 3)),
        testCase("a[^bc]d", "", UTF_8, match("aed", 0, 0, 3)),
        testCase("a[^-b]c", "", UTF_8, match("adc", 0, 0, 3)),
        testCase("a[^]b]c", "", UTF_8, match("adc", 0, 0, 3)),
        testCase("ab|cd", "", UTF_8,
            match("abc", 0, 0, 2),
            match("abcd", 0, 0, 2)),
        testCase("a\\(b", "", UTF_8, match("a(b", 0, 0, 3)),
        testCase("a\\(*b", "", UTF_8,
            match("ab", 0, 0, 2),
            match("a((b", 0, 0, 4)),
        testCase("((a))", "", UTF_8, match("abc", 0, 0, 1, 0, 1, 0, 1)),
        testCase("(a)b(c)", "", UTF_8, match("abc", 0, 0, 3, 0, 1, 2, 3)),
        testCase("a+b+c", "", UTF_8, match("aabbabc", 0, 4, 7)),
        testCase("a*", "", UTF_8,
            match("aaa", 0, 0, 3),
            match("a", 0, 0, 1)),
        testCase("(a*)*", "", UTF_8,
            match("-", 0, 0, 0, 0, 0),
            match("a", 0, 0, 1, 1, 1),
            match("ax", 0, 0, 1, 1, 1),
            match("x", 0, 0, 0, 0, 0),
            match("aaaaaa", 0, 0, 6, 6, 6),
            match("aaaaaax", 0, 0, 6, 6, 6),
            match("aaaaaaaaaaaaaaa", 0, 0, 15, 15, 15)),
        testCase("(a*)+", "", UTF_8,
            match("-", 0, 0, 0, 0, 0),
            match("a", 0, 0, 1, 1, 1),
            match("x", 0, 0, 0, 0, 0),
            match("aaaaaa", 0, 0, 6, 6, 6),
            match("aaaaaax", 0, 0, 6, 6, 6)),
        testCase("(a+|b)*", "", UTF_8, match("ab", 0, 0, 2, 1, 2)),
        testCase("(a+|b)+", "", UTF_8, match("ab", 0, 0, 2, 1, 2)),
        testCase("(a+|b)?", "", UTF_8, match("ab", 0, 0, 1, 0, 1)),
        testCase("[^ab]*", "", UTF_8, match("cde", 0, 0, 3)),
        testCase("(^)*", "", UTF_8, match("-", 0, 0, 0, 0, 0)),
        testCase("([abc])*d", "", UTF_8, match("abbbcd", 0, 0, 6, 4, 5)),
        testCase("([abc])*bcd", "", UTF_8, match("abcd", 0, 0, 4, 0, 1)),
        testCase("a|b|c|d|e", "", UTF_8, match("e", 0, 0, 1)),
        testCase("(a|b|c|d|e)f", "", UTF_8, match("ef", 0, 0, 2, 0, 1)),
        testCase("((a*|b))*", "", UTF_8, match("-", 0, 0, 0, 0, 0, 0, 0)),
        testCase("abcd*efg", "", UTF_8, match("abcdefg", 0, 0, 7)),
        testCase("ab*", "", UTF_8,
            match("xabyabbbz", 0, 1, 3),
            match("xayabbbz", 0, 1, 2)),
        testCase("(ab|cd)e", "", UTF_8, match("abcde", 0, 2, 5, 2, 4)),
        testCase("[abhgefdc]ij", "", UTF_8, match("hij", 0, 0, 3)),
        testCase("(a|b)c*d", "", UTF_8, match("abcd", 0, 1, 4, 1, 2)),
        testCase("(ab|ab*)bc", "", UTF_8, match("abc", 0, 0, 3, 0, 1)),
        testCase("a([bc]*)c*", "", UTF_8, match("abc", 0, 0, 3, 1, 3)),
        testCase("a([bc]*)(c*d)", "", UTF_8, match("abcd", 0, 0, 4, 1, 3, 3, 4)),
        testCase("a([bc]+)(c*d)", "", UTF_8, match("abcd", 0, 0, 4, 1, 3, 3, 4)),
        testCase("a([bc]*)(c+d)", "", UTF_8, match("abcd", 0, 0, 4, 1, 2, 2, 4)),
        testCase("a[bcd]*dcdcde", "", UTF_8, match("adcdcde", 0, 0, 7)),
        testCase("(ab|a)b*c", "", UTF_8, match("abc", 0, 0, 3, 0, 2)),
        testCase("((a)(b)c)(d)", "", UTF_8, match("abcd", 0, 0, 4, 0, 3, 0, 1, 1, 2, 3, 4)),
        testCase("[A-Za-z_][A-Za-z0-9_]*", "", UTF_8, match("alpha", 0, 0, 5)),
        testCase("^a(bc+|b[eh])g|.h$", "", UTF_8, match("abh", 0, 1, 3, -1, -1)),
        testCase("(bc+d$|ef*g.|h?i(j|k))", "", UTF_8,
            match("effgz", 0, 0, 5, 0, 5, -1, -1),
            match("ij", 0, 0, 2, 0, 2, 1, 2),
            match("reffgz", 0, 1, 6, 1, 6, -1, -1)),
        testCase("(((((((((a)))))))))", "", UTF_8, match("a", 0, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1)),
        testCase("multiple words", "", UTF_8, match("multiple words yeah", 0, 0, 14)),
        testCase("(.*)c(.*)", "", UTF_8, match("abcde", 0, 0, 5, 0, 2, 3, 5)),
        testCase("abcd", "", UTF_8, match("abcd", 0, 0, 4)),
        testCase("a(bc)d", "", UTF_8, match("abcd", 0, 0, 4, 1, 3)),
        testCase("a[\u0001-\u0003]?c", "", UTF_8, match("a\u0002c", 0, 0, 3)),
        testCase("M[ou]'?am+[ae]r .*([AEae]l[- ])?[GKQ]h?[aeu]+([dtz][dhz]?)+af[iy]", "", UTF_8,
            match("Muammar Qaddafi", 0, 0, 15, -1, -1, 10, 12),
            match("Mo'ammar Gadhafi", 0, 0, 16, -1, -1, 11, 13),
            match("Muammar Kaddafi", 0, 0, 15, -1, -1, 10, 12),
            match("Muammar Qadhafi", 0, 0, 15, -1, -1, 10, 12),
            match("Muammar Gadafi", 0, 0, 14, -1, -1, 10, 11),
            match("Mu'ammar Qadafi", 0, 0, 15, -1, -1, 11, 12),
            match("Moamar Gaddafi", 0, 0, 14, -1, -1, 9, 11),
            match("Mu'ammar Qadhdhafi", 0, 0, 18, -1, -1, 13, 15),
            match("Muammar Khaddafi", 0, 0, 16, -1, -1, 11, 13),
            match("Muammar Ghaddafy", 0, 0, 16, -1, -1, 11, 13),
            match("Muammar Ghadafi", 0, 0, 15, -1, -1, 11, 12),
            match("Muammar Ghaddafi", 0, 0, 16, -1, -1, 11, 13),
            match("Muamar Kaddafi", 0, 0, 14, -1, -1, 9, 11),
            match("Muammar Quathafi", 0, 0, 16, -1, -1, 11, 13),
            match("Muammar Gheddafi", 0, 0, 16, -1, -1, 11, 13),
            match("Moammar Khadafy", 0, 0, 15, -1, -1, 11, 12),
            match("Moammar Qudhafi", 0, 0, 15, -1, -1, 10, 12)),
        testCase("a+(b|c)*d+", "", UTF_8, match("aabcdd", 0, 0, 6, 3, 4)),
        testCase("^.+$", "", UTF_8, match("vivi", 0, 0, 4)),
        testCase("^(.+)$", "", UTF_8, match("vivi", 0, 0, 4, 0, 4)),
        testCase("^([^!.]+).att.com!(.+)$", "", UTF_8, match("gryphon.att.com!eby", 0, 0, 19, 0, 7, 16, 19)),
        testCase("^([^!]+!)?([^!]+)$", "", UTF_8,
            match("bas", 0, 0, 3, -1, -1, 0, 3),
            match("bar!bas", 0, 0, 7, 0, 4, 4, 7),
            match("foo!bas", 0, 0, 7, 0, 4, 4, 7)),
        testCase("^.+!([^!]+!)([^!]+)$", "", UTF_8, match("foo!bar!bas", 0, 0, 11, 4, 8, 8, 11)),
        testCase("((foo)|(bar))!bas", "", UTF_8,
            match("bar!bas", 0, 0, 7, 0, 3, -1, -1, 0, 3),
            match("foo!bar!bas", 0, 4, 11, 4, 7, -1, -1, 4, 7),
            match("foo!bas", 0, 0, 7, 0, 3, 0, 3, -1, -1)),
        testCase("((foo)|bar)!bas", "", UTF_8,
            match("bar!bas", 0, 0, 7, 0, 3, -1, -1),
            match("foo!bar!bas", 0, 4, 11, 4, 7, -1, -1),
            match("foo!bas", 0, 0, 7, 0, 3, 0, 3)),
        testCase("(foo|(bar))!bas", "", UTF_8,
            match("bar!bas", 0, 0, 7, 0, 3, 0, 3),
            match("foo!bar!bas", 0, 4, 11, 4, 7, 4, 7),
            match("foo!bas", 0, 0, 7, 0, 3, -1, -1)),
        testCase("(foo|bar)!bas", "", UTF_8,
            match("bar!bas", 0, 0, 7, 0, 3),
            match("foo!bar!bas", 0, 4, 11, 4, 7),
            match("foo!bas", 0, 0, 7, 0, 3)),
        testCase("^(([^!]+!)?([^!]+)|.+!([^!]+!)([^!]+))$", "", UTF_8,
            match("foo!bar!bas", 0, 0, 11, 0, 11, -1, -1, -1, -1, 4, 8, 8, 11),
            match("bas", 0, 0, 3, 0, 3, -1, -1, 0, 3, -1, -1, -1, -1),
            match("bar!bas", 0, 0, 7, 0, 7, 0, 4, 4, 7, -1, -1, -1, -1),
            match("foo!bas", 0, 0, 7, 0, 7, 0, 4, 4, 7, -1, -1, -1, -1)),
        testCase("^([^!]+!)?([^!]+)$|^.+!([^!]+!)([^!]+)$", "", UTF_8,
            match("bas", 0, 0, 3, -1, -1, 0, 3, -1, -1, -1, -1),
            match("bar!bas", 0, 0, 7, 0, 4, 4, 7, -1, -1, -1, -1),
            match("foo!bar!bas", 0, 0, 11, -1, -1, -1, -1, 4, 8, 8, 11),
            match("foo!bas", 0, 0, 7, 0, 4, 4, 7, -1, -1, -1, -1)),
        testCase(".*(/XXX).*", "", UTF_8, match("/XXX", 0, 0, 4, 0, 4)),
        testCase(".*(\\\\XXX).*", "", UTF_8, match("\\XXX", 0, 0, 4, 0, 4)),
        testCase("\\\\XXX", "", UTF_8, match("\\XXX", 0, 0, 4)),
        testCase(".*(/000).*", "", UTF_8, match("/000", 0, 0, 4, 0, 4)),
        testCase(".*(\\\\000).*", "", UTF_8, match("\\000", 0, 0, 4, 0, 4)),
        testCase("\\\\000", "", UTF_8, match("\\000", 0, 0, 4)),
        testCase("aa*", "", UTF_8, match("xaxaax", 0, 1, 2)),
        testCase("(a*)(ab)*(b*)", "", UTF_8, match("abc", 0, 0, 2, 0, 1, -1, -1, 1, 2)),
        testCase("((a*)(ab)*)((b*)(a*))", "", UTF_8, match("aba", 0, 0, 3, 0, 1, 0, 1, -1, -1, 1, 3, 1, 2, 2, 3)),
        testCase("(...?.?)*", "", UTF_8, match("xxxxxx", 0, 0, 6, 4, 6)),
        testCase("(a|ab)(bc|c)", "", UTF_8, match("abcabc", 0, 0, 3, 0, 1, 1, 3)),
        testCase("(aba|a*b)(aba|a*b)", "", UTF_8, match("ababa", 0, 0, 4, 0, 3, 3, 4)),
        testCase("a(b)*\\1", "", UTF_8,
            noMatch("a", 0),
            noMatch("abab", 0)),
        testCase("(a*){2}", "", UTF_8, match("xxxxx", 0, 0, 0, 0, 0)),
        testCase("(aba|a*b)*", "", UTF_8, match("ababa", 0, 0, 4, 3, 4)),
        testCase("(a(b)?)+", "", UTF_8, match("aba", 0, 0, 3, 2, 3, 1, 2)),
        testCase("(a(b)*)*\\2", "", UTF_8, match("abab", 0, 0, 4, 2, 3, 1, 2)),
        testCase("(a?)((ab)?)(b?)a?(ab)?b?", "", UTF_8, match("abab", 0, 0, 4, 0, 1, 1, 1, -1, -1, 1, 2, -1, -1)),
        testCase(".*(.*)", "", UTF_8,
            match("ab", 0, 0, 2, 2, 2),
            match("xx", 0, 0, 2, 2, 2)),
        testCase("(a|ab)(c|bcd)", "", UTF_8, match("abcd", 0, 0, 4, 0, 1, 1, 4)),
        testCase("(a|ab)(bcd|c)", "", UTF_8, match("abcd", 0, 0, 4, 0, 1, 1, 4)),
        testCase("(ab|a)(c|bcd)", "", UTF_8, match("abcd", 0, 0, 3, 0, 2, 2, 3)),
        testCase("(ab|a)(bcd|c)", "", UTF_8, match("abcd", 0, 0, 3, 0, 2, 2, 3)),
        testCase("((a|ab)(c|bcd))(d*)", "", UTF_8, match("abcd", 0, 0, 4, 0, 4, 0, 1, 1, 4, 4, 4)),
        testCase("((a|ab)(bcd|c))(d*)", "", UTF_8, match("abcd", 0, 0, 4, 0, 4, 0, 1, 1, 4, 4, 4)),
        testCase("((ab|a)(c|bcd))(d*)", "", UTF_8, match("abcd", 0, 0, 4, 0, 3, 0, 2, 2, 3, 3, 4)),
        testCase("((ab|a)(bcd|c))(d*)", "", UTF_8, match("abcd", 0, 0, 4, 0, 3, 0, 2, 2, 3, 3, 4)),
        testCase("(a|ab)((c|bcd)(d*))", "", UTF_8, match("abcd", 0, 0, 4, 0, 1, 1, 4, 1, 4, 4, 4)),
        testCase("(a|ab)((bcd|c)(d*))", "", UTF_8, match("abcd", 0, 0, 4, 0, 1, 1, 4, 1, 4, 4, 4)),
        testCase("(ab|a)((c|bcd)(d*))", "", UTF_8, match("abcd", 0, 0, 4, 0, 2, 2, 4, 2, 3, 3, 4)),
        testCase("(ab|a)((bcd|c)(d*))", "", UTF_8, match("abcd", 0, 0, 4, 0, 2, 2, 4, 2, 3, 3, 4)),
        testCase("(a*)(b|abc)", "", UTF_8, match("abc", 0, 0, 2, 0, 1, 1, 2)),
        testCase("(a*)(abc|b)", "", UTF_8, match("abc", 0, 0, 2, 0, 1, 1, 2)),
        testCase("((a*)(b|abc))(c*)", "", UTF_8, match("abc", 0, 0, 3, 0, 2, 0, 1, 1, 2, 2, 3)),
        testCase("((a*)(abc|b))(c*)", "", UTF_8, match("abc", 0, 0, 3, 0, 2, 0, 1, 1, 2, 2, 3)),
        testCase("(a*)((b|abc)(c*))", "", UTF_8, match("abc", 0, 0, 3, 0, 1, 1, 3, 1, 2, 2, 3)),
        testCase("(a*)((abc|b)(c*))", "", UTF_8, match("abc", 0, 0, 3, 0, 1, 1, 3, 1, 2, 2, 3)),
        testCase("(a|ab)", "", UTF_8, match("ab", 0, 0, 1, 0, 1)),
        testCase("(ab|a)", "", UTF_8, match("ab", 0, 0, 2, 0, 2)),
        testCase("(a|ab)(b*)", "", UTF_8, match("ab", 0, 0, 2, 0, 1, 1, 2)),
        testCase("(ab|a)(b*)", "", UTF_8, match("ab", 0, 0, 2, 0, 2, 2, 2)),
        testCase("a+", "", UTF_8, match("xaax", 0, 1, 3)),
        testCase(".(a*).", "", UTF_8, match("xaax", 0, 0, 4, 1, 3)),
        testCase("(a?)((ab)?)", "", UTF_8, match("ab", 0, 0, 1, 0, 1, 1, 1, -1, -1)),
        testCase("(a?)((ab)?)(b?)", "", UTF_8, match("ab", 0, 0, 2, 0, 1, 1, 1, -1, -1, 1, 2)),
        testCase("((a?)((ab)?))(b?)", "", UTF_8, match("ab", 0, 0, 2, 0, 1, 0, 1, 1, 1, -1, -1, 1, 2)),
        testCase("(a?)(((ab)?)(b?))", "", UTF_8, match("ab", 0, 0, 2, 0, 1, 1, 2, 1, 1, -1, -1, 1, 2)),
        testCase("(.?)", "", UTF_8, match("x", 0, 0, 1, 0, 1)),
        testCase("(.?){1}", "", UTF_8, match("x", 0, 0, 1, 0, 1)),
        testCase("(.?)(.?)", "", UTF_8, match("x", 0, 0, 1, 0, 1, 1, 1)),
        testCase("(.?){2}", "", UTF_8, match("x", 0, 0, 1, 1, 1)),
        testCase("(.?)*", "", UTF_8, match("x", 0, 0, 1, 1, 1)),
        testCase("(.?.?)", "", UTF_8, match("xxx", 0, 0, 2, 0, 2)),
        testCase("(.?.?){1}", "", UTF_8, match("xxx", 0, 0, 2, 0, 2)),
        testCase("(.?.?)(.?.?)", "", UTF_8, match("xxx", 0, 0, 3, 0, 2, 2, 3)),
        testCase("(.?.?){2}", "", UTF_8, match("xxx", 0, 0, 3, 2, 3)),
        testCase("(.?.?)(.?.?)(.?.?)", "", UTF_8, match("xxx", 0, 0, 3, 0, 2, 2, 3, 3, 3)),
        testCase("(.?.?){3}", "", UTF_8, match("xxx", 0, 0, 3, 3, 3)),
        testCase("(.?.?)*", "", UTF_8, match("xxx", 0, 0, 3, 3, 3)),
        testCase("a?((ab)?)(b?)", "", UTF_8, match("ab", 0, 0, 2, 1, 1, -1, -1, 1, 2)),
        testCase("(a?)((ab)?)b?", "", UTF_8, match("ab", 0, 0, 2, 0, 1, 1, 1, -1, -1)),
        testCase("a?((ab)?)b?", "", UTF_8, match("ab", 0, 0, 2, 1, 1, -1, -1)),
        testCase("(ab?)(b?a)", "", UTF_8, match("aba", 0, 0, 3, 0, 2, 2, 3)),
        testCase("(a|ab)(ba|a)", "", UTF_8, match("aba", 0, 0, 3, 0, 1, 1, 3)),
        testCase("(a|ab|ba)", "", UTF_8, match("aba", 0, 0, 1, 0, 1)),
        testCase("(a|ab|ba)(a|ab|ba)", "", UTF_8, match("aba", 0, 0, 3, 0, 1, 1, 3)),
        testCase("(a|ab|ba)*", "", UTF_8, match("aba", 0, 0, 3, 1, 3)),
        testCase("(aba|a*b)", "", UTF_8, match("ababa", 0, 0, 3, 0, 3)),
        testCase("(aba|ab|a)", "", UTF_8, match("ababa", 0, 0, 3, 0, 3)),
        testCase("(aba|ab|a)(aba|ab|a)", "", UTF_8, match("ababa", 0, 0, 5, 0, 2, 2, 5)),
        testCase("(aba|ab|a)*", "", UTF_8, match("ababa", 0, 0, 3, 0, 3)),
        testCase("(a(b)?)", "", UTF_8, match("aba", 0, 0, 2, 0, 2, 1, 2)),
        testCase("(a(b)?)(a(b)?)", "", UTF_8, match("aba", 0, 0, 3, 0, 2, 1, 2, 2, 3, -1, -1)),
        testCase("(.*)(.*)", "", UTF_8, match("xx", 0, 0, 2, 0, 2, 2, 2)),
        testCase("(a.*z|b.*y)", "", UTF_8, match("azbazby", 0, 0, 5, 0, 5)),
        testCase("(a.*z|b.*y)(a.*z|b.*y)", "", UTF_8, match("azbazby", 0, 0, 7, 0, 5, 5, 7)),
        testCase("(a.*z|b.*y)*", "", UTF_8, match("azbazby", 0, 0, 7, 5, 7)),
        testCase("(.|..)(.*)", "", UTF_8, match("ab", 0, 0, 2, 0, 1, 1, 2)),
        testCase("((..)*(...)*)", "", UTF_8, match("xxx", 0, 0, 2, 0, 2, 0, 2, -1, -1)),
        testCase("((..)*(...)*)((..)*(...)*)", "", UTF_8, match("xxx", 0, 0, 2, 0, 2, 0, 2, -1, -1, 2, 2, -1, -1, -1, -1)),
        testCase("((..)*(...)*)*", "", UTF_8, match("xxx", 0, 0, 2, 2, 2, 0, 2, -1, -1)),
        testCase("(a*)*b\\1", "", UTF_8,
            match("ab", 0, 0, 2, 1, 1),
            match("aba", 0, 0, 2, 1, 1),
            match("abaa", 0, 0, 2, 1, 1),
            match("aab", 0, 0, 3, 2, 2),
            match("aaba", 0, 0, 3, 2, 2),
            match("aabaa", 0, 0, 3, 2, 2)),
        testCase("(a*)b\\1*", "", UTF_8,
            match("ab", 0, 0, 2, 0, 1),
            match("aba", 0, 0, 3, 0, 1),
            match("abaa", 0, 0, 4, 0, 1),
            match("aab", 0, 0, 3, 0, 2),
            match("aaba", 0, 0, 3, 0, 2),
            match("aabaa", 0, 0, 5, 0, 2)),
        testCase("(a*)*b\\1*", "", UTF_8,
            match("ab", 0, 0, 2, 1, 1),
            match("aba", 0, 0, 2, 1, 1),
            match("abaa", 0, 0, 2, 1, 1),
            match("aab", 0, 0, 3, 2, 2),
            match("aaba", 0, 0, 3, 2, 2),
            match("aabaa", 0, 0, 3, 2, 2)),
        testCase("(a{0,1})*b(\\1)", "", UTF_8, match("ab", 0, 0, 2, 1, 1, 2, 2)),
        testCase("(a*)*b(\\1)", "", UTF_8, match("ab", 0, 0, 2, 1, 1, 2, 2)),
        testCase("(a*)b(\\1)*", "", UTF_8, match("ab", 0, 0, 2, 0, 1, -1, -1)),
        testCase("(a*)*b(\\1)*", "", UTF_8,
            match("ab", 0, 0, 2, 1, 1, 2, 2),
            match("aba", 0, 0, 2, 1, 1, 2, 2),
            match("abaa", 0, 0, 2, 1, 1, 2, 2),
            match("aab", 0, 0, 3, 2, 2, 3, 3),
            match("aaba", 0, 0, 3, 2, 2, 3, 3),
            match("aabaa", 0, 0, 3, 2, 2, 3, 3)),
        testCase("(x)*a\\1", "", UTF_8, noMatch("a", 0)),
        testCase("(x)*a\\1*", "", UTF_8, match("a", 0, 0, 1, -1, -1)),
        testCase("(x)*a(\\1)", "", UTF_8, noMatch("a", 0)),
        testCase("(x)*a(\\1)*", "", UTF_8, match("a", 0, 0, 1, -1, -1, -1, -1)),
        testCase("(aa(b(b))?)+", "", UTF_8, match("aabbaa", 0, 0, 6, 4, 6, 2, 4, 3, 4)),
        testCase("([ab]+)([bc]+)([cd]*)", "", UTF_8, match("abcd", 0, 0, 4, 0, 2, 2, 3, 3, 4)),
        testCase("([ab]*)([bc]*)([cd]*)\\1", "", UTF_8,
            match("abcdaa", 0, 0, 5, 0, 1, 1, 3, 3, 4),
            match("abcdab", 0, 0, 6, 0, 2, 2, 3, 3, 4)),
        testCase("([ab]*)([bc]*)([cd]*)\\1*", "", UTF_8,
            match("abcdaa", 0, 0, 4, 0, 2, 2, 3, 3, 4),
            match("abcdab", 0, 0, 6, 0, 2, 2, 3, 3, 4)),
        testCase("^(A([^B]*))?(B(.*))?", "", UTF_8,
            match("Aa", 0, 0, 2, 0, 2, 1, 2, -1, -1, -1, -1),
            match("Bb", 0, 0, 2, -1, -1, -1, -1, 0, 2, 1, 2)),
        testCase(".*([AB]).*\\1", "", UTF_8, match("ABA", 0, 0, 3, 0, 1)),
        testCase("[^A]*A", "", UTF_8, match("\\nA", 0, 0, 3)),
        testCase("(a|ab)(c|bcd)(d*)", "", UTF_8, match("abcd", 0, 0, 4, 0, 1, 1, 4, 4, 4)),
        testCase("(a|ab)(bcd|c)(d*)", "", UTF_8, match("abcd", 0, 0, 4, 0, 1, 1, 4, 4, 4)),
        testCase("(ab|a)(c|bcd)(d*)", "", UTF_8, match("abcd", 0, 0, 4, 0, 2, 2, 3, 3, 4)),
        testCase("(ab|a)(bcd|c)(d*)", "", UTF_8, match("abcd", 0, 0, 4, 0, 2, 2, 3, 3, 4)),
        testCase("(a*)(b|abc)(c*)", "", UTF_8, match("abc", 0, 0, 3, 0, 1, 1, 2, 2, 3)),
        testCase("(a*)(abc|b)(c*)", "", UTF_8, match("abc", 0, 0, 3, 0, 1, 1, 2, 2, 3)),
        testCase("(a|ab)(c|bcd)(d|.*)", "", UTF_8, match("abcd", 0, 0, 4, 0, 1, 1, 4, 4, 4)),
        testCase("(a|ab)(bcd|c)(d|.*)", "", UTF_8, match("abcd", 0, 0, 4, 0, 1, 1, 4, 4, 4)),
        testCase("(ab|a)(c|bcd)(d|.*)", "", UTF_8, match("abcd", 0, 0, 4, 0, 2, 2, 3, 3, 4)),
        testCase("(ab|a)(bcd|c)(d|.*)", "", UTF_8, match("abcd", 0, 0, 4, 0, 2, 2, 3, 3, 4)),
        testCase("(a+)*", "", UTF_8,
            match("a", 0, 0, 1, 0, 1),
            match("x", 0, 0, 0, -1, -1),
            match("aaaaaa", 0, 0, 6, 0, 6),
            match("aaaaaax", 0, 0, 6, 0, 6)),
        testCase("(a+)+", "", UTF_8,
            match("a", 0, 0, 1, 0, 1),
            noMatch("x", 0),
            match("aaaaaa", 0, 0, 6, 0, 6),
            match("aaaaaax", 0, 0, 6, 0, 6)),
        testCase("([a]*)*", "", UTF_8,
            match("a", 0, 0, 1, 1, 1),
            match("x", 0, 0, 0, 0, 0),
            match("aaaaaa", 0, 0, 6, 6, 6),
            match("aaaaaax", 0, 0, 6, 6, 6)),
        testCase("([a]*)+", "", UTF_8,
            match("a", 0, 0, 1, 1, 1),
            match("x", 0, 0, 0, 0, 0),
            match("aaaaaa", 0, 0, 6, 6, 6),
            match("aaaaaax", 0, 0, 6, 6, 6)),
        testCase("([^b]*)*", "", UTF_8,
            match("a", 0, 0, 1, 1, 1),
            match("b", 0, 0, 0, 0, 0),
            match("aaaaaa", 0, 0, 6, 6, 6),
            match("aaaaaab", 0, 0, 6, 6, 6)),
        testCase("([ab]*)*", "", UTF_8,
            match("a", 0, 0, 1, 1, 1),
            match("aaaaaa", 0, 0, 6, 6, 6),
            match("ababab", 0, 0, 6, 6, 6),
            match("bababa", 0, 0, 6, 6, 6),
            match("b", 0, 0, 1, 1, 1),
            match("bbbbbb", 0, 0, 6, 6, 6),
            match("aaaabcde", 0, 0, 5, 5, 5)),
        testCase("([^a]*)*", "", UTF_8,
            match("b", 0, 0, 1, 1, 1),
            match("bbbbbb", 0, 0, 6, 6, 6),
            match("aaaaaa", 0, 0, 0, 0, 0)),
        testCase("([^ab]*)*", "", UTF_8,
            match("ccccxx", 0, 0, 6, 6, 6),
            match("ababab", 0, 0, 0, 0, 0)),
        testCase("((z)+|a)*", "", UTF_8, match("zabcde", 0, 0, 2, 1, 2, 0, 1)),
        testCase("a+?", "", UTF_8,
            match("aaaaaa", 0, 0, 1),
            match("aaa", 0, 0, 1)),
        testCase("(a)", "", UTF_8, match("aaa", 0, 0, 1, 0, 1)),
        testCase("(a*?)", "", UTF_8, match("aaa", 0, 0, 0, 0, 0)),
        testCase("(a)*?", "", UTF_8, match("aaa", 0, 0, 0, -1, -1)),
        testCase("(a*?)*?", "", UTF_8, match("aaa", 0, 0, 0, -1, -1)),
        testCase("(a*)*(x)", "", UTF_8,
            match("x", 0, 0, 1, 0, 0, 0, 1),
            match("ax", 0, 0, 2, 1, 1, 1, 2),
            match("axa", 0, 0, 2, 1, 1, 1, 2)),
        testCase("(a*)*(x)(\\1)", "", UTF_8,
            match("x", 0, 0, 1, 0, 0, 0, 1, 1, 1),
            match("ax", 0, 0, 2, 1, 1, 1, 2, 2, 2),
            match("axa", 0, 0, 2, 1, 1, 1, 2, 2, 2)),
        testCase("(a*)*(x)(\\1)(x)", "", UTF_8,
            match("axax", 0, 0, 4, 0, 1, 1, 2, 2, 3, 3, 4),
            match("axxa", 0, 0, 3, 1, 1, 1, 2, 2, 2, 2, 3)),
        testCase("(a*)+(x)", "", UTF_8,
            match("x", 0, 0, 1, 0, 0, 0, 1),
            match("ax", 0, 0, 2, 1, 1, 1, 2),
            match("axa", 0, 0, 2, 1, 1, 1, 2)),
        testCase("(a*){2}(x)", "", UTF_8,
            match("x", 0, 0, 1, 0, 0, 0, 1),
            match("ax", 0, 0, 2, 1, 1, 1, 2),
            match("axa", 0, 0, 2, 1, 1, 1, 2)),
        testCase("((..)|(.))", "", UTF_8,
            match("a", 0, 0, 1, 0, 1, -1, -1, 0, 1),
            match("aa", 0, 0, 2, 0, 2, 0, 2, -1, -1),
            match("aaa", 0, 0, 2, 0, 2, 0, 2, -1, -1),
            match("aaaa", 0, 0, 2, 0, 2, 0, 2, -1, -1),
            match("aaaaa", 0, 0, 2, 0, 2, 0, 2, -1, -1),
            match("aaaaaa", 0, 0, 2, 0, 2, 0, 2, -1, -1)),
        testCase("((..)|(.))((..)|(.))", "", UTF_8,
            noMatch("a", 0),
            match("aa", 0, 0, 2, 0, 1, -1, -1, 0, 1, 1, 2, -1, -1, 1, 2),
            match("aaa", 0, 0, 3, 0, 2, 0, 2, -1, -1, 2, 3, -1, -1, 2, 3),
            match("aaaa", 0, 0, 4, 0, 2, 0, 2, -1, -1, 2, 4, 2, 4, -1, -1),
            match("aaaaa", 0, 0, 4, 0, 2, 0, 2, -1, -1, 2, 4, 2, 4, -1, -1),
            match("aaaaaa", 0, 0, 4, 0, 2, 0, 2, -1, -1, 2, 4, 2, 4, -1, -1)),
        testCase("((..)|(.))((..)|(.))((..)|(.))", "", UTF_8,
            noMatch("a", 0),
            noMatch("aa", 0),
            match("aaa", 0, 0, 3, 0, 1, -1, -1, 0, 1, 1, 2, -1, -1, 1, 2, 2, 3, -1, -1, 2, 3),
            match("aaaa", 0, 0, 4, 0, 2, 0, 2, -1, -1, 2, 3, -1, -1, 2, 3, 3, 4, -1, -1, 3, 4),
            match("aaaaa", 0, 0, 5, 0, 2, 0, 2, -1, -1, 2, 4, 2, 4, -1, -1, 4, 5, -1, -1, 4, 5),
            match("aaaaaa", 0, 0, 6, 0, 2, 0, 2, -1, -1, 2, 4, 2, 4, -1, -1, 4, 6, 4, 6, -1, -1)),
        testCase("((..)|(.)){1}", "", UTF_8,
            match("a", 0, 0, 1, 0, 1, -1, -1, 0, 1),
            match("aa", 0, 0, 2, 0, 2, 0, 2, -1, -1),
            match("aaa", 0, 0, 2, 0, 2, 0, 2, -1, -1),
            match("aaaa", 0, 0, 2, 0, 2, 0, 2, -1, -1),
            match("aaaaa", 0, 0, 2, 0, 2, 0, 2, -1, -1),
            match("aaaaaa", 0, 0, 2, 0, 2, 0, 2, -1, -1)),
        testCase("((..)|(.)){2}", "", UTF_8,
            noMatch("a", 0),
            match("aa", 0, 0, 2, 1, 2, -1, -1, 1, 2),
            match("aaa", 0, 0, 3, 2, 3, 0, 2, 2, 3),
            match("aaaa", 0, 0, 4, 2, 4, 2, 4, -1, -1),
            match("aaaaa", 0, 0, 4, 2, 4, 2, 4, -1, -1),
            match("aaaaaa", 0, 0, 4, 2, 4, 2, 4, -1, -1)),
        testCase("((..)|(.)){3}", "", UTF_8,
            noMatch("a", 0),
            noMatch("aa", 0),
            match("aaa", 0, 0, 3, 2, 3, -1, -1, 2, 3),
            match("aaaa", 0, 0, 4, 3, 4, 0, 2, 3, 4),
            match("aaaaa", 0, 0, 5, 4, 5, 2, 4, 4, 5),
            match("aaaaaa", 0, 0, 6, 4, 6, 4, 6, -1, -1)),
        testCase("((..)|(.))*", "", UTF_8,
            match("a", 0, 0, 1, 0, 1, -1, -1, 0, 1),
            match("aa", 0, 0, 2, 0, 2, 0, 2, -1, -1),
            match("aaa", 0, 0, 3, 2, 3, 0, 2, 2, 3),
            match("aaaa", 0, 0, 4, 2, 4, 2, 4, -1, -1),
            match("aaaaa", 0, 0, 5, 4, 5, 2, 4, 4, 5),
            match("aaaaaa", 0, 0, 6, 4, 6, 4, 6, -1, -1)),
        testCase("X(.?){0,}Y", "", UTF_8, match("X1234567Y", 0, 0, 9, 8, 8)),
        testCase("X(.?){1,}Y", "", UTF_8, match("X1234567Y", 0, 0, 9, 8, 8)),
        testCase("X(.?){2,}Y", "", UTF_8, match("X1234567Y", 0, 0, 9, 8, 8)),
        testCase("X(.?){3,}Y", "", UTF_8, match("X1234567Y", 0, 0, 9, 8, 8)),
        testCase("X(.?){4,}Y", "", UTF_8, match("X1234567Y", 0, 0, 9, 8, 8)),
        testCase("X(.?){5,}Y", "", UTF_8, match("X1234567Y", 0, 0, 9, 8, 8)),
        testCase("X(.?){6,}Y", "", UTF_8, match("X1234567Y", 0, 0, 9, 8, 8)),
        testCase("X(.?){7,}Y", "", UTF_8, match("X1234567Y", 0, 0, 9, 8, 8)),
        testCase("X(.?){8,}Y", "", UTF_8, match("X1234567Y", 0, 0, 9, 8, 8)),
        testCase("X(.?){0,8}Y", "", UTF_8, match("X1234567Y", 0, 0, 9, 8, 8)),
        testCase("X(.?){1,8}Y", "", UTF_8, match("X1234567Y", 0, 0, 9, 8, 8)),
        testCase("X(.?){2,8}Y", "", UTF_8, match("X1234567Y", 0, 0, 9, 8, 8)),
        testCase("X(.?){3,8}Y", "", UTF_8, match("X1234567Y", 0, 0, 9, 8, 8)),
        testCase("X(.?){4,8}Y", "", UTF_8, match("X1234567Y", 0, 0, 9, 8, 8)),
        testCase("X(.?){5,8}Y", "", UTF_8, match("X1234567Y", 0, 0, 9, 8, 8)),
        testCase("X(.?){6,8}Y", "", UTF_8, match("X1234567Y", 0, 0, 9, 8, 8)),
        testCase("X(.?){7,8}Y", "", UTF_8, match("X1234567Y", 0, 0, 9, 8, 8)),
        testCase("X(.?){8,8}Y", "", UTF_8, match("X1234567Y", 0, 0, 9, 8, 8)),
        testCase("(a|ab|c|bcd){0,}(d*)", "", UTF_8, match("ababcd", 0, 0, 1, 0, 1, 1, 1)),
        testCase("(a|ab|c|bcd){1,}(d*)", "", UTF_8, match("ababcd", 0, 0, 1, 0, 1, 1, 1)),
        testCase("(a|ab|c|bcd){2,}(d*)", "", UTF_8, match("ababcd", 0, 0, 6, 3, 6, 6, 6)),
        testCase("(a|ab|c|bcd){3,}(d*)", "", UTF_8, match("ababcd", 0, 0, 6, 3, 6, 6, 6)),
        testCase("(a|ab|c|bcd){4,}(d*)", "", UTF_8, noMatch("ababcd", 0)),
        testCase("(a|ab|c|bcd){0,10}(d*)", "", UTF_8, match("ababcd", 0, 0, 1, 0, 1, 1, 1)),
        testCase("(a|ab|c|bcd){1,10}(d*)", "", UTF_8, match("ababcd", 0, 0, 1, 0, 1, 1, 1)),
        testCase("(a|ab|c|bcd){2,10}(d*)", "", UTF_8, match("ababcd", 0, 0, 6, 3, 6, 6, 6)),
        testCase("(a|ab|c|bcd){3,10}(d*)", "", UTF_8, match("ababcd", 0, 0, 6, 3, 6, 6, 6)),
        testCase("(a|ab|c|bcd){4,10}(d*)", "", UTF_8, noMatch("ababcd", 0)),
        testCase("(a|ab|c|bcd)*(d*)", "", UTF_8, match("ababcd", 0, 0, 1, 0, 1, 1, 1)),
        testCase("(a|ab|c|bcd)+(d*)", "", UTF_8, match("ababcd", 0, 0, 1, 0, 1, 1, 1)),
        testCase("(ab|a|c|bcd){0,}(d*)", "", UTF_8, match("ababcd", 0, 0, 6, 4, 5, 5, 6)),
        testCase("(ab|a|c|bcd){1,}(d*)", "", UTF_8, match("ababcd", 0, 0, 6, 4, 5, 5, 6)),
        testCase("(ab|a|c|bcd){2,}(d*)", "", UTF_8, match("ababcd", 0, 0, 6, 4, 5, 5, 6)),
        testCase("(ab|a|c|bcd){3,}(d*)", "", UTF_8, match("ababcd", 0, 0, 6, 4, 5, 5, 6)),
        testCase("(ab|a|c|bcd){4,}(d*)", "", UTF_8, noMatch("ababcd", 0)),
        testCase("(ab|a|c|bcd){0,10}(d*)", "", UTF_8, match("ababcd", 0, 0, 6, 4, 5, 5, 6)),
        testCase("(ab|a|c|bcd){1,10}(d*)", "", UTF_8, match("ababcd", 0, 0, 6, 4, 5, 5, 6)),
        testCase("(ab|a|c|bcd){2,10}(d*)", "", UTF_8, match("ababcd", 0, 0, 6, 4, 5, 5, 6)),
        testCase("(ab|a|c|bcd){3,10}(d*)", "", UTF_8, match("ababcd", 0, 0, 6, 4, 5, 5, 6)),
        testCase("(ab|a|c|bcd){4,10}(d*)", "", UTF_8, noMatch("ababcd", 0)),
        testCase("(ab|a|c|bcd)*(d*)", "", UTF_8, match("ababcd", 0, 0, 6, 4, 5, 5, 6)),
        testCase("(ab|a|c|bcd)+(d*)", "", UTF_8, match("ababcd", 0, 0, 6, 4, 5, 5, 6)),
        testCase("\ufb00", "i", UTF_8, match("FF", 0, 0, 2)),
        testCase("(\ufb00)\\1", "i", UTF_8,
            match("FFFF", 0, 0, 4, 0, 2),
            match("FF\ufb00", 0, 0, 5, 0, 2),
            match("\ufb00FF", 0, 0, 5, 0, 3)),
        testCase("(F\ufb00F)\\1", "i", UTF_8,
            match("\ufb00FF\ufb00FF", 0, 0, 10, 0, 5),
            match("FFFFFFFF", 0, 0, 8, 0, 4),
            match("\ufb00\ufb00\ufb00\ufb00", 0, 0, 12, 0, 6),
            match("\ufb00\ufb00FFFF", 0, 0, 10, 0, 6),
            match("FFFF\ufb00\ufb00", 0, 0, 10, 0, 4)),
        testCase("(\ufb00\ufb00)\\1", "i", UTF_8, match("F\ufb00F\ufb00\ufb00", 0, 0, 11, 0, 5)),
        testCase("\ufb01", "i", UTF_8, match("FI", 0, 0, 2)),
        testCase("(\ufb01)\\1", "i", UTF_8, match("FIFI", 0, 0, 4, 0, 2)),
        testCase("\ufb02", "i", UTF_8, match("FL", 0, 0, 2)),
        testCase("\ufb03", "i", UTF_8,
            match("FFI", 0, 0, 3),
            match("\ufb00I", 0, 0, 4),
            match("F\ufb01", 0, 0, 4)),
        testCase("\ufb04", "i", UTF_8,
            match("FFL", 0, 0, 3),
            match("\ufb00L", 0, 0, 4),
            match("F\ufb02", 0, 0, 4)),
        testCase("\ufb00I", "i", UTF_8, match("\ufb03", 0, 0, 3)),
        testCase("F\ufb01", "i", UTF_8, match("\ufb03", 0, 0, 3)),
        testCase("\ufb00L", "i", UTF_8, match("\ufb04", 0, 0, 3)),
        testCase("F\ufb02", "i", UTF_8, match("\ufb04", 0, 0, 3)),
        testCase("[\ufb04[=a=]o]+", "i", UTF_8, match("F\ufb02a\u00c4\u00f6", 0, 0, 7)),
        testCase("\u1f50", "i", UTF_8, match("\u03c5\u0313", 0, 0, 4)),
        testCase("\u1f52", "i", UTF_8,
            match("\u03c5\u0313\u0300", 0, 0, 6),
            match("\u1f50\u0300", 0, 0, 5)),
        testCase("\u1f54", "i", UTF_8,
            match("\u03c5\u0313\u0301", 0, 0, 6),
            match("\u1f50\u0301", 0, 0, 5)),
        testCase("\u1f56", "i", UTF_8,
            match("\u03c5\u0313\u0342", 0, 0, 6),
            match("\u1f50\u0342", 0, 0, 5)),
        testCase("\u1f50\u0300", "i", UTF_8, match("\u1f52", 0, 0, 3)),
        testCase("\u1f50\u0301", "i", UTF_8, match("\u1f54", 0, 0, 3)),
        testCase("\u1f50\u0342", "i", UTF_8, match("\u1f56", 0, 0, 3)),
        testCase("\u1fb6", "i", UTF_8, match("\u03b1\u0342", 0, 0, 4)),
        testCase("\u1fb7", "i", UTF_8,
            match("\u03b1\u0342\u03b9", 0, 0, 6),
            match("\u1fb6\u03b9", 0, 0, 5)),
        testCase("\u1fb6\u03b9", "i", UTF_8, match("\u1fb7", 0, 0, 3)),
        testCase("\u1fc6", "i", UTF_8, match("\u03b7\u0342", 0, 0, 4)),
        testCase("\u1fc7", "i", UTF_8,
            match("\u03b7\u0342\u03b9", 0, 0, 6),
            match("\u1fc6\u03b9", 0, 0, 5)),
        testCase("\u1fc6\u03b9", "i", UTF_8, match("\u1fc7", 0, 0, 3)),
        testCase("\u1ff6", "i", UTF_8, match("\u03c9\u0342", 0, 0, 4)),
        testCase("\u1ff7", "i", UTF_8,
            match("\u03c9\u0342\u03b9", 0, 0, 6),
            match("\u1ff6\u03b9", 0, 0, 5)),
        testCase("\u1ff6\u03b9", "i", UTF_8, match("\u1ff7", 0, 0, 3)),
        testCase("f*", "i", UTF_8,
            match("ff", 0, 0, 2),
            match("\ufb00", 0, 0, 0)),
        testCase("f+", "i", UTF_8,
            match("ff", 0, 0, 2),
            noMatch("\ufb00", 0)),
        testCase("f{1,}", "i", UTF_8,
            match("ff", 0, 0, 2),
            noMatch("\ufb00", 0)),
        testCase("f{1,2}", "i", UTF_8,
            match("ff", 0, 0, 2),
            noMatch("\ufb00", 0)),
        testCase("f{,2}", "i", UTF_8,
            noMatch("ff", 0),
            noMatch("\ufb00", 0)),
        testCase("ff?", "i", UTF_8,
            match("ff", 0, 0, 2),
            noMatch("\ufb00", 0)),
        testCase("f{2}", "i", UTF_8,
            match("ff", 0, 0, 2),
            noMatch("\ufb00", 0)),
        testCase("f{2,2}", "i", UTF_8,
            match("ff", 0, 0, 2),
            noMatch("\ufb00", 0)),
        testCase("K", "i", UTF_8, match("\u212a", 0, 0, 3)),
        testCase("k", "i", UTF_8, match("\u212a", 0, 0, 3)),
        testCase("\\w", "i", UTF_8, match("\u212a", 0, 0, 3)),
        testCase("\\W", "i", UTF_8, noMatch("\u212a", 0)),
        testCase("[\\w]", "i", UTF_8, noMatch("\u212a", 0)),
        testCase("[\\w]+", "i", UTF_8, match("a\\wWc", 0, 1, 4)),
        testCase("[\\W]+", "i", UTF_8, match("a\\wWc", 0, 1, 4)),
        testCase("[\\d]+", "i", UTF_8, match("0\\dD9", 0, 1, 4)),
        testCase("[\\D]+", "i", UTF_8, match("a\\dDc", 0, 1, 4)),
        testCase("[\\s]+", "i", UTF_8, match(" \\sS\u0009", 0, 1, 4)),
        testCase("[\\S]+", "i", UTF_8, match(" \\sS\u0009", 0, 1, 4)),
        testCase("[kx]", "i", UTF_8, match("\u212a", 0, 0, 3)),
        testCase("ff", "i", UTF_8, match("\ufb00", 0, 0, 3)),
        testCase("[f]f", "i", UTF_8, noMatch("\ufb00", 0)),
        testCase("f[f]", "i", UTF_8, noMatch("\ufb00", 0)),
        testCase("[f][f]", "i", UTF_8, noMatch("\ufb00", 0)),
        testCase("(?:f)f", "i", UTF_8, noMatch("\ufb00", 0)),
        testCase("f(?:f)", "i", UTF_8, noMatch("\ufb00", 0)),
        testCase("(?:f)(?:f)", "i", UTF_8, noMatch("\ufb00", 0)),
        testCase("\\A[\ufb00]\\z", "i", UTF_8,
            match("\ufb00", 0, 0, 3),
            match("ff", 0, 0, 2)),
        testCase("\\A[^\ufb00]\\z", "i", UTF_8,
            noMatch("\ufb00", 0),
            noMatch("ff", 0)),
        testCase("\\A[^[^\ufb00]]\\z", "i", UTF_8,
            noMatch("\ufb00", 0),
            noMatch("ff", 0)),
        testCase("\\A[[^[^\ufb00]]]\\z", "i", UTF_8,
            noMatch("\ufb00", 0),
            noMatch("ff", 0)),
        testCase("[^a-c]", "i", UTF_8, noMatch("A", 0)),
        testCase("[[^a-c]]", "i", UTF_8, noMatch("A", 0)),
        testCase("[^a]", "i", UTF_8, noMatch("a", 0)),
        testCase("[[^a]]", "i", UTF_8, noMatch("a", 0)),
        testCase("\\A\\W\\z", "i", UTF_8,
            noMatch("\ufb00", 0),
            noMatch("ff", 0),
            noMatch("\ufb03", 0),
            noMatch("ffi", 0),
            noMatch("\ufb00i", 0)),
        testCase("\\A[\\p{L}]\\z", "i", UTF_8,
            noMatch("\ufb00", 0),
            noMatch("ff", 0),
            noMatch("\ufb03", 0),
            noMatch("ffi", 0),
            noMatch("\ufb00i", 0)),
        testCase("([[=a=]])\\1", "i", UTF_8,
            match("aA", 0, 0, 2, 0, 1),
            match("Aa", 0, 0, 2, 0, 1),
            noMatch("a\u00e4", 0),
            noMatch("a\u00c4", 0),
            noMatch("\u00e4a", 0),
            noMatch("\u00c4a", 0),
            noMatch("\u00c4A", 0)),
        testCase("[[=a=]o]+", "i", UTF_8, match("\u00e4O\u00f6", 0, 0, 3)),
        testCase("[[=\u00df=]o]+", "i", UTF_8,
            noMatch("s", 0),
            match("ss", 0, 0, 2)),
        testCase("[[=\u00df=]o]+", "", UTF_8,
            noMatch("s", 0),
            match("ss", 0, 0, 2)),
        testCase("[\u0132]+", "", UTF_8, noMatch("ij", 0)),
        testCase("[\u0132]+", "i", UTF_8, noMatch("ij", 0)),
        testCase("[[=\u0132=]]+", "", UTF_8, match("ij", 0, 0, 2)),
        testCase("[[=\u0132=]o]+", "", UTF_8, match("ij", 0, 0, 2)),
        testCase("[[=\u0132=]o]+", "i", UTF_8, match("ij", 0, 0, 2)),
        testCase("[\\s-r]+", "", UTF_8, syntaxError(ErrorCode.InvalidCharacterClass)),
        testCase("[\\s-v]+", "", UTF_8, match("\\stu", 0, 0, 4)),
        testCase("$(\\A|)", "", UTF_8, match("x", 0, 1, 1, 1, 1)),
        testCase("(^\\w)|()^", "", UTF_8, match("empty", 0, 0, 1, 0, 1, -1, -1)),
        testCase("a(b|())", "", UTF_8, match("ab", 0, 0, 2, 1, 2, -1, -1)),
        testCase("(a|())*", "", UTF_8,
            match("aaa", 0, 0, 3, 3, 3, 3, 3),
            match("a", 0, 0, 1, 1, 1, 1, 1)),
        testCase("a|", "", UTF_8,
            match("a", 0, 0, 1),
            match("b", 0, 0, 0),
            match("a|", 0, 0, 1),
            match("b|", 0, 0, 0)),
        testCase("a|?", "", UTF_8,
            match("a", 0, 0, 1),
            match("b", 0, 0, 0),
            match("?", 0, 0, 0)),
        testCase("|", "", UTF_8, match("b", 0, 0, 0)),
        testCase("a|()", "", UTF_8,
            match("a", 0, 0, 1, -1, -1),
            match("b", 0, 0, 0, 0, 0)),
        testCase("a||", "", UTF_8,
            match("a", 0, 0, 1),
            match("b", 0, 0, 0)),
        testCase("a||b", "", UTF_8,
            match("a", 0, 0, 1),
            match("b", 0, 0, 0),
            match("c", 0, 0, 0)),
        testCase("a||b|", "", UTF_8,
            match("a", 0, 0, 1),
            match("b", 0, 0, 0),
            match("c", 0, 0, 0)),
        testCase("a|()|", "", UTF_8,
            match("a", 0, 0, 1, -1, -1),
            match("b", 0, 0, 0, 0, 0)),
        testCase("(a|)", "", UTF_8,
            match("a", 0, 0, 1, 0, 1),
            match("b", 0, 0, 0, 0, 0)),
        testCase("|a", "", UTF_8,
            match("a", 0, 0, 0),
            match("b", 0, 0, 0)),
        testCase("|a|", "", UTF_8,
            match("a", 0, 0, 0),
            match("b", 0, 0, 0)),
        testCase("||a|", "", UTF_8, match("b", 0, 0, 0)),
        testCase("|()|", "", UTF_8, match("a", 0, 0, 0, -1, -1)),
        testCase("a\\Z\\z[[:cntrl:]]", "", UTF_8, noMatch("a\n", 0)),
        testCase("\\z", "", UTF_8,
            match("a", 0, 1, 1),
            match("\n", 0, 1, 1),
            match("a\n", 0, 2, 2)),
        testCase("\\Z", "", UTF_8,
            match("a", 0, 1, 1),
            match("\n", 0, 0, 0),
            match("a\n", 0, 1, 1)),
        testCase("a\\z", "", UTF_8,
            match("a", 0, 0, 1),
            noMatch("\n", 0),
            noMatch("a\n", 0)),
        testCase("a\\Z", "", UTF_8,
            match("a", 0, 0, 1),
            noMatch("\n", 0),
            match("a\n", 0, 0, 1)),
        testCase("\n\\z", "", UTF_8,
            noMatch("a", 0),
            match("\n", 0, 0, 1),
            match("a\n", 0, 1, 2)),
        testCase("\n\\Z", "", UTF_8,
            noMatch("a", 0),
            match("\n", 0, 0, 1),
            match("a\n", 0, 1, 2)),
        testCase("\n$", "", UTF_8,
            noMatch("a", 0),
            match("\n", 0, 0, 1),
            match("a\n", 0, 1, 2)),
        testCase("a\n\\z", "", UTF_8,
            noMatch("a", 0),
            noMatch("\n", 0),
            match("a\n", 0, 0, 2)),
        testCase("a\n\\Z", "", UTF_8,
            noMatch("a", 0),
            noMatch("\n", 0),
            match("a\n", 0, 0, 2)),
        testCase("a\n$", "", UTF_8,
            noMatch("a", 0),
            noMatch("\n", 0),
            match("a\n", 0, 0, 2)),
        testCase("a\\z\n", "", UTF_8, noMatch("a\n", 0)),
        testCase("a\\Z\n", "", UTF_8, match("a\n", 0, 0, 2)),
        testCase("(^|\\Z)a", "", UTF_8, match("a", 0, 0, 1, 0, 0)),
        testCase("\\z|\\Z", "", UTF_8,
            match("\n", 0, 0, 0),
            match("a\n", 0, 1, 1)),
        testCase("\\Z|\\z", "", UTF_8,
            match("\n", 0, 0, 0),
            match("a\n", 0, 1, 1)),
        testCase("a\\z\\Z", "", UTF_8, noMatch("a\n", 0)),
        testCase("a\\Z\\z", "", UTF_8, noMatch("a\n", 0)),
        testCase("a\n\\z\\Z", "", UTF_8, match("a\n", 0, 0, 2)),
        testCase("a\n\\Z\\z", "", UTF_8, match("a\n", 0, 0, 2)),
        testCase("a\\z\\Z\n", "", UTF_8, noMatch("a\n", 0)),
        testCase("a\\Z\\z\n", "", UTF_8, noMatch("a\n", 0)),
        testCase("a(|()|())*", "", UTF_8, match("a", 0, 0, 1, 1, 1, -1, -1, -1, -1)),
        testCase("a(()|()|)*b", "", UTF_8, match("ab", 0, 0, 2, 1, 1, 1, 1, -1, -1)),
        testCase("a(()|()|())*b", "", UTF_8, match("ab", 0, 0, 2, 1, 1, 1, 1, -1, -1, -1, -1)),
        testCase("a(()|()|()|())*b", "", UTF_8, match("ab", 0, 0, 2, 1, 1, 1, 1, -1, -1, -1, -1, -1, -1)),
        testCase("a(b|()|()|()|())*c", "", UTF_8,
            match("abc", 0, 0, 3, 2, 2, 2, 2, -1, -1, -1, -1, -1, -1),
            match("abbc", 0, 0, 4, 3, 3, 3, 3, -1, -1, -1, -1, -1, -1)),
        testCase("a(()|b|()|()|())*c", "", UTF_8,
            match("abc", 0, 0, 3, 2, 2, 2, 2, -1, -1, -1, -1, -1, -1),
            match("abbc", 0, 0, 4, 3, 3, 3, 3, -1, -1, -1, -1, -1, -1)),
        testCase("a(()|()|b|()|())*c", "", UTF_8,
            match("abc", 0, 0, 3, 2, 2, 2, 2, -1, -1, -1, -1, -1, -1),
            match("abbc", 0, 0, 4, 3, 3, 3, 3, -1, -1, -1, -1, -1, -1)),
        testCase("a(()|()|()|b|())*c", "", UTF_8,
            match("abc", 0, 0, 3, 2, 2, 2, 2, -1, -1, -1, -1, -1, -1),
            match("abbc", 0, 0, 4, 3, 3, 3, 3, -1, -1, -1, -1, -1, -1)),
        testCase("a(()|()|()|()|b)*c", "", UTF_8,
            match("abc", 0, 0, 3, 2, 2, 2, 2, -1, -1, -1, -1, -1, -1),
            match("abbc", 0, 0, 4, 3, 3, 3, 3, -1, -1, -1, -1, -1, -1)),
        testCase("()??()??()??()??()??()??()??()??\\3\\5\\7", "", UTF_8, match("a", 0, 0, 0, -1, -1, -1, -1, 0, 0, -1, -1, 0, 0, -1, -1, 0, 0, -1, -1)),
        testCase("()*", "", UTF_8, match("a", 0, 0, 0, 0, 0)),
        testCase("(a|)*", "", UTF_8, match("a", 0, 0, 1, 1, 1)),
        testCase("(|a)?", "", UTF_8, match("a", 0, 0, 0, 0, 0)),
        testCase("()??\\1", "", UTF_8, match("a", 0, 0, 0, 0, 0)),
        testCase("(a|())*?\\2", "", UTF_8, match("a", 0, 0, 1, 1, 1, 1, 1)),
        testCase("[[.\\].]]", "", UTF_8, syntaxError(ErrorCode.InvalidCharacterClass)),
        testCase("[[.\\[.]]", "", UTF_8, syntaxError(ErrorCode.InvalidCharacterClass)),
        testCase("[[=\\]=]]", "", UTF_8, syntaxError(ErrorCode.InvalidCharacterClass)),
        testCase("[[=\\[=]]", "", UTF_8, syntaxError(ErrorCode.InvalidCharacterClass)),
        testCase("[--I]", "", UTF_8, match("-", 0, 0, 1)),
        testCase("[[=^=]--I]", "", UTF_8, syntaxError(ErrorCode.InvalidCharacterClass)),
        testCase("[[=\\}=]I]", "", UTF_8, syntaxError(ErrorCode.InvalidCharacterClass)),
        testCase("[I-[=\\}=]]", "", UTF_8, syntaxError(ErrorCode.InvalidCharacterClass)),
        testCase("[y-\\{]", "", UTF_8, syntaxError(ErrorCode.InvalidCharacterClass)),
        testCase("[y-\\{][y-\\{]", "", UTF_8, syntaxError(ErrorCode.InvalidCharacterClass)),
        testCase("a?", "", UTF_8,
            match("aaa", 0, 0, 1),
            match("a", 0, 0, 1)),
        testCase("a??", "", UTF_8,
            match("aaa", 0, 0, 0),
            match("a", 0, 0, 0)),
        testCase("((a?)*)??", "", UTF_8, match("aaa", 0, 0, 0, -1, -1, -1, -1)),
        testCase("((a?)*?)?", "", UTF_8, match("aaa", 0, 0, 0, 0, 0, -1, -1)),
        testCase("(a+)*?", "", UTF_8, match("aaa", 0, 0, 0, -1, -1)),
        testCase("((a+)*)?", "", UTF_8, match("aaa", 0, 0, 3, 0, 3, 0, 3)),
        testCase("[[.\\a.]]", "", UTF_8, syntaxError(ErrorCode.InvalidCharacterClass)),
        testCase("[[...]]", "", UTF_8,
            match(".", 0, 0, 1),
            noMatch("[", 0),
            noMatch("]", 0),
            match(".]", 0, 0, 1)),
        testCase("[[.\\..]]", "", UTF_8, syntaxError(ErrorCode.InvalidCharacterClass)),
        testCase("[[...]a]", "", UTF_8, match(".a]", 0, 0, 1)),
        testCase("[a[...]]", "", UTF_8, match("a]", 0, 0, 1)),
        testCase("[[...]a]a", "", UTF_8, noMatch("a", 0)),
        testCase("[[...]a]?a", "", UTF_8, match("a", 0, 0, 1)),
        testCase("[[...]a]|a", "", UTF_8, match("a", 0, 0, 1)),
        testCase("[[===]]", "", UTF_8,
            match("=", 0, 0, 1),
            match("=]", 0, 0, 1)),
        testCase("[[=\\==]]", "", UTF_8, syntaxError(ErrorCode.InvalidCharacterClass)),
        testCase("[[===]a]", "", UTF_8, match("=a]", 0, 0, 1)),
        testCase("[a[===]]", "", UTF_8, match("a]", 0, 0, 1)),
        testCase("[[===]a]a", "", UTF_8,
            match("aa", 0, 0, 2),
            noMatch("a]a", 0)),
        testCase("[[===]a]?a", "", UTF_8, match("a", 0, 0, 1)),
        testCase("[[===]a]|a", "", UTF_8, match("a", 0, 0, 1)),
        testCase("\\\\(a+)", "", UTF_8,
            match("(\\a)", 0, 1, 3, 2, 3),
            match("\\a)", 0, 0, 2, 1, 2)),
        testCase("\\\\(a)", "", UTF_8,
            match("\\a)", 0, 0, 2, 1, 2),
            match("(\\a)", 0, 1, 3, 2, 3),
            noMatch("\\(a)", 0),
            noMatch("\\\\(a)", 0)),
        testCase("\\\\(a)+", "", UTF_8,
            match("\\a\\a", 0, 0, 2, 1, 2),
            match("\\aa", 0, 0, 3, 2, 3)),
        testCase("\\(a)", "", UTF_8, syntaxError(ErrorCode.UnmatchedParenthesis)),
        testCase("\\()", "", UTF_8, syntaxError(ErrorCode.UnmatchedParenthesis)),
        testCase("\\\\()", "", UTF_8, match("\\a)", 0, 0, 1, 1, 1)),
        testCase("\\\\(a)b", "", UTF_8, match("\\ab", 0, 0, 3, 1, 2)),
        testCase("\\\\(a)()b", "", UTF_8, match("\\ab", 0, 0, 3, 1, 2, 2, 2)),
        testCase("\\\\(a)()()()()()()()()()()b", "", UTF_8, match("\\ab", 0, 0, 3, 1, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2)),
        testCase("\\[[=a=]c-b]", "", UTF_8, match("[ac-b]", 0, 0, 6)),
        testCase("\\[[.a.]c-b]", "", UTF_8, match("[ac-b]", 0, 0, 6)),
        testCase("\\[[=a=]c-b", "", UTF_8, match("[ac-b]", 0, 0, 5)),
        testCase("\\[[.a.]c-b", "", UTF_8, match("[ac-b]", 0, 0, 5)),
        testCase("[=a=]c-b]", "", UTF_8, match("[ac-b]", 0, 1, 6)),
        testCase("\\[[a=]c-b]", "", UTF_8, match("[ac-b]", 0, 0, 6)),
        testCase("\\[[=a]c-b]", "", UTF_8, match("[ac-b]", 0, 0, 6)),
        testCase("\\[[=]c-b]", "", UTF_8, match("[=c-b]", 0, 0, 6)),
        testCase("\\[[a]c-b]", "", UTF_8, match("[ac-b]", 0, 0, 6)),
        testCase("\\[[=a=]b-b]*", "", UTF_8,
            noMatch("[[aabb", 0),
            noMatch("[aabb", 0),
            noMatch("[aabb]]", 0),
            noMatch("[aabb==]]", 0),
            noMatch("aabb", 0)),
        testCase("\\[b-b]", "", UTF_8, match("[b-b]", 0, 0, 5)),
        testCase("\\[[b-b]", "", UTF_8, match("[b-b]", 0, 0, 2)),
        testCase("\\[c-b]", "", UTF_8, match("[c-b]", 0, 0, 5)),
        testCase("\\[[c-b]", "", UTF_8, syntaxError(ErrorCode.InvalidCharacterClass)),
        testCase("ac??bc?", "", UTF_8,
            match("abc", 0, 0, 3),
            match("acbc", 0, 0, 4)),
        testCase("(a?)??", "", UTF_8, match("a", 0, 0, 0, -1, -1)),
        testCase("(a??)?", "", UTF_8, match("a", 0, 0, 0, 0, 0)),
        testCase("(a{0,1})*", "", UTF_8, match("aaaaaa", 0, 0, 6, 6, 6)),
        testCase("(a{0,2})*", "", UTF_8,
            match("aaaaaa", 0, 0, 6, 6, 6),
            match("aaa", 0, 0, 3, 3, 3),
            match("aaaa", 0, 0, 4, 4, 4)),
        testCase("(a{1,2})*", "", UTF_8, match("aaaaaa", 0, 0, 6, 4, 6)),
        testCase("(a{2,2})*", "", UTF_8, match("aaaaaa", 0, 0, 6, 4, 6)),
        testCase("(\\d)", "", UTF_8, match("\u1a89", 0, 0, 3, 0, 3)),
        testCase("a^^?", "", UTF_8, noMatch("a", 0)),
        testCase("a||b{2,5}", "", UTF_8, match("aaaaa", 0, 0, 1)),
        testCase("a||b{1,5}", "", UTF_8, match("aaaaa", 0, 0, 1)),
        testCase("a|b{1,5}", "", UTF_8, match("aaaaa", 0, 0, 1)),
        testCase("[^]()|(())||()|u\\A\\6k()\\Z[\\(](|Z^|[[=A=]]|[[=k=]])", "", UTF_8, match(":Z", 0, 0, 1, 1, 1)),
        testCase("(a*?)*", "", UTF_8, match("aaa", 0, 0, 0, 0, 0)),
        testCase("?a{1,2}||b", "", UTF_8, match("ccc", 0, 0, 0)),
        testCase("()?a{1,2}||b", "", UTF_8, match("ccc", 0, 0, 0, -1, -1)),
        testCase("[a-a]", "", UTF_8, match("a", 0, 0, 1)),
        testCase("[---]", "", UTF_8, match("-", 0, 0, 1)),
        testCase("[a---]", "", UTF_8, syntaxError(ErrorCode.InvalidCharacterClass)),
        testCase("[a-a---]", "", UTF_8, match("-", 0, 0, 1)),
        testCase("[a-a---[:alpha:]]", "", UTF_8, match("-", 0, 0, 1)),
        testCase("[---[:alpha:]]", "", UTF_8, match("-", 0, 0, 1)),
        testCase("[a-c-e]", "", UTF_8,
            match("-", 0, 0, 1),
            match("a", 0, 0, 1),
            match("b", 0, 0, 1),
            match("c", 0, 0, 1),
            noMatch("d", 0),
            match("e", 0, 0, 1)),
        testCase("a?a+?", "", UTF_8, match("aaa", 0, 0, 2)),
        testCase("()a\\1\\1", "", UTF_8, match("a", 0, 0, 1, 0, 0)),
        testCase("()\\1\\1a", "", UTF_8, match("a", 0, 0, 1, 0, 0)),
        testCase("(a)\\1\\1b", "", UTF_8, match("aaab", 0, 0, 4, 0, 1)),
        testCase("[[:space:]-y]", "", UTF_8,
            match("empty", 0, 4, 5),
            match("empt-y", 0, 4, 5)),
        testCase("[[:space:]--y]", "", UTF_8, match("empty", 0, 0, 1)),
        testCase("a{1,2}|", "", UTF_8, match("ccc", 0, 0, 0)),
        testCase("?a{1,2}|", "", UTF_8, match("ccc", 0, 0, 0)),
        testCase("()?a{1,2}|", "", UTF_8, match("ccc", 0, 0, 0, -1, -1)),
        testCase("()a{1,2}|", "", UTF_8, match("ccc", 0, 0, 0, -1, -1)),
        testCase("b?a{1,2}|", "", UTF_8, match("ccc", 0, 0, 0)),
        testCase("(|[ab]){3,3}?b", "", UTF_8, match("aab", 0, 0, 3, 2, 2)),
        testCase("(|[ab]){3,3}b", "", UTF_8, match("aab", 0, 0, 3, 2, 2)),
        testCase("(|[ab]){3}b", "", UTF_8, match("aab", 0, 0, 3, 2, 2)),
        testCase("(|a){3}b", "", UTF_8, match("aab", 0, 0, 3, 2, 2)),
        testCase("(|a){2}b", "", UTF_8, match("ab", 0, 0, 2, 1, 1)),
        testCase("(|a){1}b", "", UTF_8, match("b", 0, 0, 1, 0, 0)),
        testCase("(|a)b", "", UTF_8, match("b", 0, 0, 1, 0, 0)),
        testCase("(|a)(|a)(|a)b", "", UTF_8, match("aab", 0, 0, 3, 0, 0, 0, 1, 1, 2)),
        testCase("(|a)(|a)b", "", UTF_8, match("ab", 0, 0, 2, 0, 0, 0, 1)),
        testCase("(|a+?){0,4}", "", UTF_8, match("aaa", 0, 0, 0, 0, 0)),
        testCase("(|a+?){0,4}b", "", UTF_8, match("aaab", 0, 0, 4, 3, 3)),
        testCase("[^][.a[.b.]]", "", UTF_8, syntaxError(ErrorCode.InvalidCharacterClass)),
        testCase("[^[.a[.b.]]", "", UTF_8, syntaxError(ErrorCode.InvalidCharacterClass)),
        testCase("[[.a[.b.]]*", "", UTF_8, syntaxError(ErrorCode.InvalidCharacterClass)),
        testCase("[[.a[.b.]*]*", "", UTF_8, syntaxError(ErrorCode.InvalidCharacterClass)),
        testCase("[[=abcdefgh=]*]*", "", UTF_8, syntaxError(ErrorCode.InvalidCharacterClass)),
        testCase("[^]", "", UTF_8, syntaxError(ErrorCode.UnmatchedBracket)),
        testCase("[^]]", "", UTF_8, match("[]^", 0, 0, 1)),
        testCase("[[.a.b.]]", "", UTF_8, syntaxError(ErrorCode.InvalidCharacterClass)),
        testCase("\\z|((\\WV|))\\Z", "", UTF_8, match("a", 0, 1, 1, -1, -1, -1, -1)),
        testCase("\\z|(\\WV|)\\Z", "", UTF_8, match("a", 0, 1, 1, -1, -1)),
        testCase("\\z|(x|)\\Z", "", UTF_8, match("a", 0, 1, 1, -1, -1)),
        testCase("a(|())\\2", "", UTF_8, match("a", 0, 0, 1, 1, 1, 1, 1)),
        testCase("a(|())\\2?", "", UTF_8, match("a", 0, 0, 1, 1, 1, -1, -1)),
        testCase("a(|())\\2*", "", UTF_8, match("a", 0, 0, 1, 1, 1, -1, -1)),
        testCase("a(|())\\2+", "", UTF_8, match("a", 0, 0, 1, 1, 1, 1, 1)),
        testCase("a(|())\\2{1}", "", UTF_8, match("a", 0, 0, 1, 1, 1, 1, 1)),
        testCase("a(|())\\2{1,2}", "", UTF_8, match("a", 0, 0, 1, 1, 1, 1, 1)),
        testCase("a(|())\\2{2,3}", "", UTF_8, match("a", 0, 0, 1, 1, 1, 1, 1)),
        testCase("a(b|()\\1|\\2){4}", "", UTF_8, match("abb", 0, 0, 3, 3, 3, 2, 2)),
        testCase("\\D([[=O=]S[.f.]]|\\s|(())\\1|\\3(|)){27,222}?", "", UTF_8, match("\"O f\u000b  OoOO O\r O", 0, 0, 16, 16, 16, 10, 10, 10, 10, 16, 16)),
        testCase("a??|", "", UTF_8, match("a", 0, 0, 0)),
        testCase("b?a??|", "", UTF_8, match("a", 0, 0, 0)),
        testCase("b??a??|", "", UTF_8, match("a", 0, 0, 0)),
        testCase("a??a?|", "", UTF_8, match("a", 0, 0, 1)),
        testCase("a??a??|", "", UTF_8, match("a", 0, 0, 0)),
        testCase("(|a)a??|", "", UTF_8, match("a", 0, 0, 0, 0, 0)),
        testCase("(|a)(|a)|", "", UTF_8, match("a", 0, 0, 0, 0, 0, 0, 0)),
        testCase("a??a??a??|", "", UTF_8, match("a", 0, 0, 0)),
        testCase("b??a??", "", UTF_8, match("a", 0, 0, 0)),
        testCase("(a??)a??|", "", UTF_8, match("a", 0, 0, 0, 0, 0)),
        testCase("(a??)(a??)|", "", UTF_8, match("a", 0, 0, 0, 0, 0, 0, 0)),
        testCase("()b??a??|", "", UTF_8, match("a", 0, 0, 0, 0, 0)),
        testCase("a{2,71920}", "", UTF_8, syntaxError(ErrorCode.InvalidQuantifier)),
        testCase("()\\1\\z", "", UTF_8, match("a", 0, 1, 1, 1, 1)),
        testCase("()\\1\\1\\z", "", UTF_8, match("a", 0, 1, 1, 1, 1)),
        testCase("[]\\\\", "", UTF_8, syntaxError(ErrorCode.UnmatchedBracket)),
        testCase("[[:print:][.j.]]\\S;[0-HB]t", "", UTF_8, noMatch("$*iAt\u0005;;Et", 0)),
        testCase("\\s\\Dz()[[.o.][:blank:][:upper:][=c=]'[.0.][:blank:]<-M}-}[=r=][.h.][=e=]]", "", UTF_8, noMatch(" &zzh", 0)),
        testCase("()(a\\1\\1)*", "", UTF_8, match("aaaa", 0, 0, 4, 0, 0, 3, 4)),
        testCase("8(?\\A\\D|)[j-{[:punct:][=:=]](\\1[d[./.]]\\1{10,20}?)*\\z|", "", UTF_8, match("8://dd/d///d/d", 0, 0, 14, 1, 1, 13, 14)),
        testCase("(a*())*", "", UTF_8, match("aaaaaaaaaaaaaaa", 0, 0, 15, 15, 15, 15, 15)),
        testCase("([^a])*[^b]+", "", UTF_8, match("ccccc", 0, 0, 5, 3, 4)),
        testCase("([^a])*[^b]+[^a]", "", UTF_8, match("cccccccccccccccc", 0, 0, 16, 13, 14)),
        testCase("(\\S)*\\D+\\S", "", UTF_8, match("\u0007c\u0004\u0012U\u0019\u001a/to!\u000f\u0012M+~QO", 0, 0, 18, 15, 16)),
        testCase("a*?b?|b", "", UTF_8, match("b", 0, 0, 1)),
        testCase("[][::A]]", "", UTF_8, match(":]", 0, 0, 2)),
        testCase("[[::AA]]", "", UTF_8, match(":]", 0, 0, 2)),
        testCase("()^\\s()(\\1\\1|\\\\\\1\\1)+()\\2[_|-~[.>.][:lower:]]|\\w\\s\\1|", "", UTF_8, match(" \\\\>", 0, 0, 4, 0, 0, 1, 1, 3, 3, 3, 3)),
        testCase("\\W\\d\\]+?\\+?'\\D((|\\d\\2)4S(5)O\\W){1,278}\\w", "", UTF_8, match("`9]]]]]]]'~4S5O?4S5O`74S5O|4S5O{04S5O}V", 0, 0, 39, 32, 38, 32, 33, 35, 36)),
        testCase("H(@\\S|4|\\1\\D|\\z*)+?()H\\Wh", "", UTF_8, noMatch("H@\u0012@\u0008@J4%@\u0002\u00054H&h", 0)),
        testCase("\\d(A(()()i(|(??\\5)\\W))|\\A)*[T]", "", UTF_8, match("3AiAi\u007fAiAi@T", 0, 0, 12, 8, 11, 9, 11, 9, 9, 9, 9, 10, 11, 10, 10)),
        testCase("o|([[:blank:][:punct:]I[=_=]])*?$", "", UTF_8, match("}~", 0, 0, 2, 1, 2)),
        testCase("()*?()a+?", "", UTF_8, noMatch("b", 0)),
        testCase("()\\1*\\1\\1+\\1?\\1", "", UTF_8, match("b", 0, 0, 0, 0, 0)),
        testCase("((b\\2|)a)+", "", UTF_8, match("aba", 0, 0, 3, 1, 3, 1, 2)),
        testCase("(\\A{1,10}a)*?\\z", "", UTF_8, match("aa", 0, 2, 2, -1, -1)),
        testCase("[0-d]", "i", UTF_8, noMatch("L", 0)),
        testCase("[W-`]", "i", UTF_8, noMatch("hK", 0)),
        testCase("[x]|[\\\\t-|]\\+", "i", UTF_8, match("X+", 0, 0, 1)),
        testCase("[N[:upper:]]|", "i", UTF_8, match("empty", 0, 0, 0)),
        testCase("\u00df", "i", UTF_8, match("ss", 0, 0, 2)),
        testCase("\u00dfs", "i", UTF_8, match("sss", 0, 0, 3)),
        testCase("s\u00dfs", "i", UTF_8, match("\u00df\u00df", 0, 0, 4)),
        testCase("[s]\u00dfs", "i", UTF_8, noMatch("\u00df\u00df", 0)),
        testCase("s[\u00df]s", "i", UTF_8, noMatch("\u00df\u00df", 0)),
        testCase("s\u00df[s]", "i", UTF_8, noMatch("\u00df\u00df", 0)),
        testCase("\u00df\u00df", "i", UTF_8, match("s\u00dfs", 0, 0, 4)),
        testCase("[\u00df]\u00df", "i", UTF_8, noMatch("s\u00dfs", 0)),
        testCase("s\u00df", "i", UTF_8,
            match("sss", 0, 0, 3),
            match("\u00dfs", 0, 0, 3)),
        testCase("sss", "i", UTF_8, match("\u00dfs", 0, 0, 3)),
        testCase("[\u00df]", "i", UTF_8, match("ss", 0, 0, 2)),
        testCase("[\u00dfs]", "", UTF_8, match("ss", 0, 0, 1)),
        testCase("[s\u00df]", "", UTF_8, match("ss", 0, 0, 1)),
        testCase("[[.\u00df.]s]", "", UTF_8, match("ss", 0, 0, 1)),
        testCase("[[=\u00df=]s]", "", UTF_8, match("ss", 0, 0, 2)),
        testCase("[s[.\u00df.]]", "", UTF_8, match("ss", 0, 0, 1)),
        testCase("[s[=\u00df=]]", "", UTF_8, match("ss", 0, 0, 1)),
        testCase("[\u00dfs]", "i", UTF_8, match("ss", 0, 0, 2)),
        testCase("[\u00dfs]{2}", "i", UTF_8, noMatch("ss", 0)),
        testCase("[\u00dfs]{1}", "i", UTF_8,
            match("ss", 0, 0, 2),
            match("s", 0, 0, 1)),
        testCase("[s\u00df]", "i", UTF_8, match("ss", 0, 0, 1)),
        testCase("[\u00dfs-s]", "i", UTF_8, match("ss", 0, 0, 2)),
        testCase("[s-s\u00df]", "i", UTF_8, match("ss", 0, 0, 1)),
        testCase("[\u00df-\u00df]", "i", UTF_8, noMatch("ss", 0)),
        testCase("[^\u00df]", "i", UTF_8,
            match("ss", 0, 1, 2),
            match("s", 0, 0, 1),
            match("sx", 0, 0, 1)),
        testCase("[^\u00df-\u00df]", "i", UTF_8, match("ss", 0, 0, 1)),
        testCase("[^s]", "i", UTF_8,
            noMatch("ss", 0),
            noMatch("SS", 0)),
        testCase("[^h-tx]", "i", UTF_8, noMatch("SS", 0)),
        testCase("[^-f]", "i", UTF_8, match("fI", 0, 1, 2)),
        testCase("[\ufb03]", "i", UTF_8, match("FFI", 0, 0, 3)),
        testCase("[\ufb03f]", "i", UTF_8,
            match("FFI", 0, 0, 3),
            match("FF", 0, 0, 1),
            match("FFX", 0, 0, 1),
            match("F", 0, 0, 1)),
        testCase("[\ufb03\ufb00]", "i", UTF_8,
            match("FFI", 0, 0, 3),
            match("FF", 0, 0, 2),
            noMatch("F", 0)),
        testCase("[\ufb03\ufb00]i", "i", UTF_8, noMatch("FFI", 0)),
        testCase("(\ufb03|\ufb00)i", "i", UTF_8, match("FFI", 0, 0, 3, 0, 2)),
        testCase("[\ufb00]i", "i", UTF_8, match("FFI", 0, 0, 3)),
        testCase("[\ufb03\ufb04]", "i", UTF_8, match("FFL", 0, 0, 3)),
        testCase("[[=\u2167=]\u491f-\u9af9[:graph:]\u1490-\u7662[.\u4d67.]\uec18[:print:][.\u45cc.]]", "i", UTF_8, match("L", 0, 0, 1)),
        testCase("[[=\u1e9a=]]", "i", UTF_8, noMatch("a", 0)),
        testCase("[\u1f89-\u8ff9]", "i", UTF_8, match("empty", 0, 0, 1)),
        testCase("[\ud83b\udd2d-\ud83c\udd63]", "i", UTF_8, noMatch("w", 0)),
        testCase("[[=\u01c6=]]", "i", UTF_8, noMatch("Dz", 0)),
        testCase("[[=\u00d7=]]", "i", UTF_8, noMatch("O", 0)),
        testCase("[[.\ud9fa\udc11.][.\ud962\udd68.][:cntrl:][=\ud98e\uddb1=]][[=\ud89d\udfb9=]]+?", "i", UTF_8, noMatch("\u0014\u001a\u0008\u007f\u0001\u007f\u007f", 0)),
        testCase("\u1f8d", "i", UTF_8, noMatch("\u1f85", 0)),
        testCase("[\u1f9d]", "i", UTF_8, noMatch("\u1f95", 0)),
        testCase("[\u1ff3]", "i", UTF_8, noMatch("\u1ffc", 0)),
        testCase("^", "m", UTF_8,
            match("\n", 0, 0, 0),
            match("a\n", 0, 0, 0),
            match("a\n", 1, 2, 2),
            match("aa\n", 1, 3, 3),
            match("a\na", 0, 0, 0),
            match("a\na", 1, 2, 2),
            match("aa\na", 1, 3, 3),
            match("\na", 0, 0, 0),
            match("\na", 1, 1, 1)),
        testCase("a^a", "m", UTF_8, noMatch("aa\na", 1)),
        testCase("a\n^a", "m", UTF_8, noMatch("aa\na", 1)),
        testCase("a^\na", "m", UTF_8, noMatch("aa\na", 1)),
        testCase("$", "m", UTF_8,
            match("\n", 0, 0, 0),
            match("\na", 0, 0, 0),
            match("\na", 1, 2, 2),
            match("a\na", 0, 1, 1),
            match("a\na", 1, 1, 1),
            match("aa\na", 1, 2, 2)),
        testCase("${1}", "m", UTF_8, match("a\na", 1, 1, 1)),
        testCase("$()", "m", UTF_8, match("a\na", 1, 1, 1, 1, 1)),
        testCase("$(){1}", "m", UTF_8, match("a\na", 1, 1, 1, 1, 1)),
        testCase("a$a", "m", UTF_8, noMatch("aa\na", 1)),
        testCase("a\n$a", "m", UTF_8, noMatch("aa\na", 1)),
        testCase("a$\na", "m", UTF_8, noMatch("aa\na", 1)),
        testCase("^$", "m", UTF_8,
            match("\n", 0, 0, 0),
            match("a\n", 0, 2, 2),
            match("a\n", 1, 2, 2),
            match("aa\n", 1, 3, 3),
            noMatch("a\na", 0),
            noMatch("a\na", 1),
            noMatch("aa\na", 1),
            match("a\n\na", 0, 2, 2),
            match("a\n\na", 1, 2, 2),
            match("aa\n\na", 1, 3, 3)),
        testCase("$^", "m", UTF_8,
            match("\n", 0, 0, 0),
            match("a\n", 0, 2, 2),
            match("a\n", 1, 2, 2),
            match("aa\n", 1, 3, 3),
            noMatch("a\na", 0),
            noMatch("a\na", 1),
            noMatch("aa\na", 1),
            match("a\n\na", 0, 2, 2),
            match("a\n\na", 1, 2, 2),
            match("aa\n\na", 1, 3, 3)),
        testCase("$\n", "m", UTF_8, noMatch("aa\n\na", 1)),
        testCase("$(\n)", "m", UTF_8, noMatch("aa\n\na", 1)),
        testCase("^a", "m", UTF_8, match("aaa\naa", 1, 4, 5)),
        testCase("^(^)", "m", UTF_8,
            match("\na", 0, 0, 0, 0, 0),
            match("\na", 1, 1, 1, 1, 1)),
        testCase("^^a", "m", UTF_8,
            match("\na", 0, 1, 2),
            match("\n\na", 1, 2, 3),
            match("\na", 1, 1, 2)),
        testCase("^^", "m", UTF_8,
            match("\n\n\n", 1, 1, 1),
            match("\n\n\n", 0, 0, 0),
            match("\n\na", 1, 1, 1),
            match("\na", 1, 1, 1)),
        testCase("^(^)a", "m", UTF_8, match("\na", 0, 1, 2, 1, 1)),
        testCase("$?", "m", UTF_8, match("empty", 0, 0, 0)),
        testCase("\\A$\\A", "m", UTF_8, match("\n", 0, 0, 0)),
        testCase("$$", "m", UTF_8, match("\n", 0, 0, 0)),
        testCase("$($)", "m", UTF_8, match("\n", 0, 0, 0, 0, 0)),
        testCase("\\Z^", "m", UTF_8, match("\n", 0, 0, 0)),
        testCase("^\\z|", "m", UTF_8, match("\n", 0, 0, 0)),
        testCase("$*", "m", UTF_8, match("empty", 0, 0, 0)),
        testCase("$^()|$?", "m", UTF_8, match("empty", 0, 0, 0, -1, -1)),
        testCase("\\Z\\W", "m", UTF_8, match("\n", 0, 0, 1)),
        testCase("\\Z\\D", "m", UTF_8, match("\n", 0, 0, 1)),
        testCase("\\W\\D()\\Z\\s", "m", UTF_8, match("\u17f6\u1855\n", 0, 0, 7, 6, 6)),
        testCase("$()\\1", "m", UTF_8, match("\n", 0, 1, 1, 1, 1)),
        testCase("\\Z()\\1()", "m", UTF_8, match("empty", 0, 5, 5, 5, 5, 5, 5)),
        testCase("^\\z", "nm", UTF_8, match("\n", 0, 1, 1)),
        testCase("(()|*?)\\w\\d[[=\ud988\uddf0=][.\udb06\ude6e.][:space:]]*^()k\ud9ae\udc34", "m", UTF_8, noMatch("\u05ba\u0a67\u202f \u205f\ud988\uddf0\u205f\u0009\nk\ud9ae\udc34", 0)),
        testCase("$\\Z^", "m", UTF_8, match("\n", 0, 0, 0)),
        testCase("$()\\Z\\1", "m", UTF_8, match("\n", 0, 1, 1, 1, 1)),
        testCase("${1,2}", "mx", UTF_8, match("\n", 0, 0, 0)),
        testCase("\\(ADDRESS=(\\([^()]+\\))+\\)", "i", UTF_8, match("(address=(x))", 0, 0, 13, 9, 12)),
        testCase("[[.\u1ef8.]]", "ic", UTF_8, noMatch("\u1ef9", 0)),
        testCase("\\D$\\z", "m", UTF_8, match("x\n", 0, 1, 2)),
        testCase("($)\\z\\1", "m", UTF_8, match("\n", 0, 1, 1, 1, 1)),
        testCase("$(()+\\2|)\\z", "m", UTF_8, match("\n", 0, 1, 1, 1, 1, 1, 1)),
        testCase("$()\\z\\1", "m", UTF_8, match("\n", 0, 1, 1, 1, 1)),
        testCase("$(()\\2|)\\z", "m", UTF_8, match("\n", 0, 1, 1, 1, 1, 1, 1)),
        testCase("$(())\\z\\2^", "m", UTF_8, match("\n", 0, 1, 1, 1, 1, 1, 1)),
        testCase("$(())\\z^\\2", "m", UTF_8, match("\n\n", 0, 2, 2, 2, 2, 2, 2)),
        testCase("\\W$\\z", "m", UTF_8, match(" \n", 0, 1, 2)),
        testCase("($)+?\\1", "m", UTF_8, match("\n", 0, 1, 1, 1, 1)),
        testCase("\\s$\\z", "m", UTF_8, match(" \n", 0, 1, 2)),
        testCase("[\ua762-\ua78d]", "i", UTF_8, noMatch("\ua7ae", 0)),
        testCase("[\u1f1d-\ua7ab]", "i", UTF_8, noMatch("\u2c63", 0)),
        testCase("[\u10b1-\u1cac]", "i", UTF_8, noMatch("\u1f04", 0)),
        testCase("($)*\\s*", "m", UTF_8, match("\n ", 0, 0, 0, 0, 0)),
        testCase("$*\\s*", "m", UTF_8, match("\n ", 0, 0, 0)),
        testCase("(^|(|a))b\\z", "", UTF_8, match("b", 0, 0, 1, 0, 0, -1, -1)),
        testCase("(a*()*)*", "", UTF_8, match("aaa", 0, 0, 3, 3, 3, 3, 3)),
        testCase("(a*()+)+", "", UTF_8, match("aaa", 0, 0, 3, 3, 3, 3, 3)),
        testCase("(a*()+?)+", "", UTF_8, match("aaa", 0, 0, 3, 3, 3, 3, 3)),
        testCase("a((b|)+)+c", "", UTF_8, match("abbbc", 0, 0, 5, 4, 4, 4, 4)),
        testCase("((a|)+)+(b)+c", "", UTF_8, match("aaabc", 0, 0, 5, 3, 3, 3, 3, 3, 4)),
        testCase("(a*()+?b*?)+c", "", UTF_8, match("aabaac", 0, 0, 6, 5, 5, 5, 5)),
        testCase("((\\w|)()+)+", "i", UTF_8, match("empty", 0, 0, 5, 5, 5, 5, 5, 5, 5)),
        testCase("(a?()?){3,4}", "", UTF_8, match("aa", 0, 0, 2, 2, 2, 2, 2)),
        testCase("(a?()+){3,4}", "", UTF_8, match("aa", 0, 0, 2, 2, 2, 2, 2)),
        testCase("a(b\\1|)*?()+c", "", UTF_8, noMatch("abc", 0)),
        testCase("()(a*\\1+)*", "", UTF_8, match("aaa", 0, 0, 3, 0, 0, 3, 3)),
        testCase("(a(\\2b|)?)+\\1c", "", UTF_8, match("aaabaaac", 0, 0, 8, 5, 6, 6, 6)),
        testCase("((|ab)+?w\\Z|^c)de()d", "", UTF_8, noMatch("ffffff", 0)),
        testCase("((a|){2,3}){2,3}", "", UTF_8, match("aaaa", 0, 0, 4, 4, 4, 4, 4)),
        testCase("((a?){2,3}){2,3}", "", UTF_8, match("aaaa", 0, 0, 4, 4, 4, 4, 4)),
        testCase("((|a){2,3}){2,3}", "", UTF_8, match("aaaa", 0, 0, 0, 0, 0, 0, 0)),
        testCase("((a??){2,3}){2,3}", "", UTF_8, match("aaaa", 0, 0, 0, 0, 0, 0, 0)),
        testCase("(|(a\\zb)|e\\2f)??\\1", "", UTF_8, match("xxxxx", 0, 0, 0, 0, 0, -1, -1)),
        testCase("(a{2}?|)*", "", UTF_8,
            match("abaaaaaa", 0, 0, 0, 0, 0),
            match("aaaaaaaa", 0, 0, 8, 8, 8)),
        testCase("(a$){1,23}?", "", UTF_8, match("aaa", 0, 2, 3, 2, 3)),
        testCase("(a\\1|){2,5}?", "", UTF_8, match("a", 0, 0, 0, 0, 0)),
        testCase("(a\\1|){2,5}?$", "", UTF_8, match("a", 0, 1, 1, 1, 1)),
        testCase("(a\\1\\1|){2,5}?$", "", UTF_8, match("a", 0, 1, 1, 1, 1)),
        testCase("(a\\1\\1|){2,5}?$||", "", UTF_8, match("a", 0, 0, 0, -1, -1)),
        testCase("(a\\1\\1|){2,5}?$|()\\2", "", UTF_8, match("a", 0, 0, 0, -1, -1, 0, 0)),
        testCase("(a\\1\\1|){2,5}?$||()\\2", "", UTF_8, match("a", 0, 0, 0, -1, -1, -1, -1)),
        testCase("(a{2}|())+", "", UTF_8, match("aaaa", 0, 0, 4, 4, 4, 4, 4)),
        testCase("(\\1|a){35,74}?", "", UTF_8, noMatch("aaaaaaaaaaaaaaaaaaaa", 0)),
        testCase("^a(b*)\\1{4,6}?", "", UTF_8,
            match("abbbb", 0, 0, 1, 1, 1),
            match("abbbbb", 0, 0, 6, 1, 2)),
        testCase("(a|)\\1{20,20}", "", UTF_8, match("aaaa", 0, 0, 0, 0, 0)),
        testCase("(a|)a*\\1{20,20}", "", UTF_8, match("aaaa", 0, 0, 4, 0, 0)),
        testCase("(a)b\\1()?", "", UTF_8, match("aba", 0, 0, 3, 0, 1, 3, 3)),
        testCase("(a)(|\\1){4,4}bb", "", UTF_8, match("aaabb", 0, 0, 5, 0, 1, 3, 3)),
        testCase("(\\1|a|)*", "", UTF_8, match("aaa", 0, 0, 3, 3, 3)),
        testCase("a([bc]|()\\1|\\2){27,222}?", "", UTF_8, match("abcbbc", 0, 0, 6, 6, 6, 4, 4)),
        testCase("((a)\\2){4,10}", "", UTF_8, match("aaaaaaaa", 0, 0, 8, 6, 8, 6, 7)),
        testCase("()\\1(|b){2,2}?c", "", UTF_8, match("bc", 0, 0, 2, 0, 0, 1, 1)),
        testCase("\u0282\\\ud807\udfdd+\u1cf2", "", UTF_8, match("\u0282\ud807\udfdd\ud807\udfdd\u1cf2", 0, 0, 13)),
        testCase("((A|){7,10}?){10,17}", "", UTF_8, match("AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA", 0, 0, 86, 86, 86, 86, 86)),
        testCase("(a{1,30}){1,4}", "", UTF_8, match("a", 0, 0, 1, 0, 1)),
        testCase("((a|){4,6}){4,6}", "", UTF_8,
            match("a", 0, 0, 1, 1, 1, 1, 1),
            match("aa", 0, 0, 2, 2, 2, 2, 2),
            match("aaa", 0, 0, 3, 3, 3, 3, 3),
            match("aaaa", 0, 0, 4, 4, 4, 4, 4),
            match("aaaaa", 0, 0, 5, 5, 5, 5, 5),
            match("aaaaaa", 0, 0, 6, 6, 6, 6, 6),
            match("aaaaaaa", 0, 0, 7, 7, 7, 7, 7),
            match("aaaaaaaa", 0, 0, 8, 8, 8, 8, 8),
            match("aaaaaaaaa", 0, 0, 9, 9, 9, 9, 9),
            match("aaaaaaaaaa", 0, 0, 10, 10, 10, 10, 10),
            match("aaaaaaaaaaa", 0, 0, 11, 11, 11, 11, 11),
            match("aaaaaaaaaaaa", 0, 0, 12, 12, 12, 12, 12),
            match("aaaaaaaaaaaaa", 0, 0, 13, 13, 13, 13, 13)),
        testCase("((a?){4,6}){4,6}", "", UTF_8,
            match("aaaaaaa", 0, 0, 7, 7, 7, 7, 7),
            match("aaaaaa", 0, 0, 6, 6, 6, 6, 6)),
        testCase("((|a){4,6}){4,6}", "", UTF_8,
            match("a", 0, 0, 0, 0, 0, 0, 0),
            match("aa", 0, 0, 0, 0, 0, 0, 0),
            match("aaa", 0, 0, 0, 0, 0, 0, 0),
            match("aaaa", 0, 0, 0, 0, 0, 0, 0),
            match("aaaaa", 0, 0, 0, 0, 0, 0, 0),
            match("aaaaaa", 0, 0, 0, 0, 0, 0, 0),
            match("aaaaaaa", 0, 0, 0, 0, 0, 0, 0),
            match("aaaaaaaa", 0, 0, 0, 0, 0, 0, 0),
            match("aaaaaaaaa", 0, 0, 0, 0, 0, 0, 0),
            match("aaaaaaaaaa", 0, 0, 0, 0, 0, 0, 0),
            match("aaaaaaaaaaa", 0, 0, 0, 0, 0, 0, 0),
            match("aaaaaaaaaaaa", 0, 0, 0, 0, 0, 0, 0),
            match("aaaaaaaaaaaaa", 0, 0, 0, 0, 0, 0, 0)),
        testCase("((a??){4,6}){4,6}", "", UTF_8, match("aaaaaaa", 0, 0, 0, 0, 0, 0, 0)),
        testCase("(a|^){100}", "", UTF_8,
            match("a", 0, 0, 0, 0, 0),
            match("aa", 0, 0, 0, 0, 0),
            noMatch("aa", 1),
            noMatch("ab", 1)),
        testCase("(a|){4,6}", "", UTF_8,
            match("a", 0, 0, 1, 1, 1),
            match("aa", 0, 0, 2, 2, 2),
            match("aaa", 0, 0, 3, 3, 3),
            match("aaaa", 0, 0, 4, 4, 4),
            match("aaaaa", 0, 0, 5, 5, 5),
            match("aaaaaa", 0, 0, 6, 5, 6),
            match("aaaaaaa", 0, 0, 6, 5, 6)),
        testCase("(a|){4,6}?", "", UTF_8,
            match("a", 0, 0, 1, 1, 1),
            match("aa", 0, 0, 2, 2, 2),
            match("aaa", 0, 0, 3, 3, 3),
            match("aaaa", 0, 0, 4, 3, 4),
            match("aaaaa", 0, 0, 4, 3, 4),
            match("aaaaaa", 0, 0, 4, 3, 4),
            match("aaaaaaa", 0, 0, 4, 3, 4)),
        testCase("(a|){4,6}?a", "", UTF_8,
            match("a", 0, 0, 1, 0, 0),
            match("aa", 0, 0, 2, 1, 1),
            match("aaa", 0, 0, 3, 2, 2),
            match("aaaa", 0, 0, 4, 3, 3),
            match("aaaaa", 0, 0, 5, 3, 4),
            match("aaaaaa", 0, 0, 5, 3, 4),
            match("aaaaaaa", 0, 0, 5, 3, 4),
            match("aaaaaaaa", 0, 0, 5, 3, 4)),
        testCase("(|a){4,6}a", "", UTF_8,
            match("a", 0, 0, 1, 0, 0),
            match("aa", 0, 0, 1, 0, 0),
            match("aaa", 0, 0, 1, 0, 0),
            match("aaaa", 0, 0, 1, 0, 0),
            match("aaaaa", 0, 0, 1, 0, 0),
            match("aaaaaa", 0, 0, 1, 0, 0),
            match("aaaaaaa", 0, 0, 1, 0, 0)),
        testCase("((a|){4,6}?){4,6}", "", UTF_8,
            match("a", 0, 0, 1, 1, 1, 1, 1),
            match("aa", 0, 0, 2, 2, 2, 2, 2),
            match("aaa", 0, 0, 3, 3, 3, 3, 3),
            match("aaaa", 0, 0, 4, 4, 4, 4, 4),
            match("aaaaa", 0, 0, 5, 5, 5, 5, 5),
            match("aaaaaa", 0, 0, 6, 6, 6, 6, 6),
            match("aaaaaaaa", 0, 0, 8, 8, 8, 8, 8),
            match("aaaaaaaaa", 0, 0, 9, 9, 9, 9, 9),
            match("aaaaaaaaaa", 0, 0, 10, 10, 10, 10, 10),
            match("aaaaaaaaaaa", 0, 0, 11, 11, 11, 11, 11),
            match("aaaaaaaaaaaa", 0, 0, 12, 12, 12, 12, 12),
            match("aaaaaaaaaaaaa", 0, 0, 13, 13, 13, 13, 13),
            match("aaaaaaaaaaaaaa", 0, 0, 14, 14, 14, 14, 14),
            match("aaaaaaaaaaaaaaa", 0, 0, 15, 15, 15, 15, 15),
            match("aaaaaaaaaaaaaaaa", 0, 0, 16, 16, 16, 16, 16),
            match("aaaaaaaaaaaaaaaaa", 0, 0, 17, 17, 17, 17, 17),
            match("aaaaaaaaaaaaaaaaaa", 0, 0, 18, 18, 18, 18, 18)),
        testCase("((a){4,6}?){4,6}", "", UTF_8,
            noMatch("a", 0),
            noMatch("aa", 0),
            noMatch("aaa", 0),
            noMatch("aaaa", 0),
            noMatch("aaaaa", 0),
            noMatch("aaaaaa", 0),
            match("aaaaaaaaaaaaaaaa", 0, 0, 16, 12, 16, 15, 16),
            match("aaaaaaaaaaaaaaaaa", 0, 0, 16, 12, 16, 15, 16),
            match("aaaaaaaaaaaaaaaaaaaa", 0, 0, 20, 16, 20, 19, 20),
            match("aaaaaaaaaaaaaaaaaaaaaaaa", 0, 0, 24, 20, 24, 23, 24),
            match("aaaaaaaaaaaaaaaaaaaaaaaaa", 0, 0, 24, 20, 24, 23, 24)),
        testCase("((a){4,6}){4,6}", "", UTF_8,
            noMatch("a", 0),
            noMatch("aa", 0),
            noMatch("aaa", 0),
            noMatch("aaaa", 0),
            noMatch("aaaaa", 0),
            noMatch("aaaaaa", 0),
            match("aaaaaaaaaaaaaaaa", 0, 0, 16, 12, 16, 15, 16),
            match("aaaaaaaaaaaaaaaaa", 0, 0, 17, 13, 17, 16, 17),
            match("aaaaaaaaaaaaaaaaaaaa", 0, 0, 20, 16, 20, 19, 20),
            match("aaaaaaaaaaaaaaaaaaaaaaaa", 0, 0, 24, 18, 24, 23, 24),
            match("aaaaaaaaaaaaaaaaaaaaaaaaa", 0, 0, 24, 18, 24, 23, 24)),
        testCase("((a){4,}){4,6}", "", UTF_8,
            noMatch("a", 0),
            noMatch("aa", 0),
            noMatch("aaa", 0),
            noMatch("aaaa", 0),
            noMatch("aaaaa", 0),
            noMatch("aaaaaa", 0),
            match("aaaaaaaaaaaaaaaa", 0, 0, 16, 12, 16, 15, 16),
            match("aaaaaaaaaaaaaaaaa", 0, 0, 17, 13, 17, 16, 17),
            match("aaaaaaaaaaaaaaaaaaaa", 0, 0, 20, 16, 20, 19, 20),
            match("aaaaaaaaaaaaaaaaaaaaaaaa", 0, 0, 24, 20, 24, 23, 24),
            match("aaaaaaaaaaaaaaaaaaaaaaaaa", 0, 0, 25, 21, 25, 24, 25)),
        testCase("(.)\\1{2,}", "", UTF_8, noMatch("billiam", 0)),
        testCase("(^_(a{1,2}[:])*a{1,2}[:]a{1,2}([.]a{1,4})?_)+", "", UTF_8, match("_a:a:a.aaa_", 0, 0, 11, 0, 11, 1, 3, 6, 10)),
        testCase("(a{2}|())+$", "", UTF_8, match("aaaa", 0, 0, 4, 4, 4, 4, 4)),
        testCase("(?<=|$)", "", UTF_8, match("a", 0, 1, 1, 1, 1)),
        testCase("(?=ab)a", "", UTF_8, noMatch("ab", 0)),
        testCase("(?=()|^)|x", "", UTF_8, match("empty", 0, 0, 0, 0, 0, -1, -1)),
        testCase("a(?<=ba)", "", UTF_8, noMatch("ba", 0)),
        testCase("(?<=(?<=a)[])", "i", UTF_8, syntaxError(ErrorCode.UnmatchedBracket)),
        testCase("(?<=(?=|()))", "", UTF_8, noMatch("aa", 0)),
        testCase("\\d\\W", "i", UTF_8, noMatch("4\u017f", 0)),
        testCase("[\u08bc-\ucf3a]", "i", UTF_8, noMatch("\u03b0", 0)),
        testCase("[\u0450-\u6c50]\u7e57\u55ad()\u64e7\\d|", "i", UTF_8, match("\u03b0\u7e57\u55ad\u64e79", 0, 0, 0, -1, -1)),
        testCase("(?<=(?<=a)b^c)c", "", UTF_8, noMatch("abcc", 0)),
        testCase("a(?:|()\\1){1,2}", "", UTF_8, noMatch("a", 0)),
        testCase("|(?<\\d\\1)\ub7e4", "", UTF_8, match("error", 0, 0, 0, -1, -1)),
        testCase("[a-z][a-z\u2028\u2029].|ab(?<=[a-z]w.)", "", UTF_8, match("aac", 0, 0, 3, -1, -1)),
        testCase("(animation|animation-name)", "", UTF_8, match("animation", 0, 0, 9, 0, 9)),
        testCase("(a|){7,7}b", "", UTF_8, match("aaab", 0, 0, 4, 3, 3)),
        testCase("(a|){7,7}?b", "", UTF_8, match("aaab", 0, 0, 4, 3, 3)),
        testCase("(|a){7,7}b", "", UTF_8, match("aaab", 0, 0, 4, 3, 3)),
        testCase("(|a){7,7}?b", "", UTF_8, match("aaab", 0, 0, 4, 3, 3)),
        testCase("(a||b){7,7}c", "", UTF_8,
            match("aaabc", 0, 0, 5, 4, 4),
            match("aaac", 0, 0, 4, 3, 3),
            match("aaabac", 0, 0, 6, 5, 5)),
        testCase("($|a){7,7}", "", UTF_8, match("aaa", 0, 0, 3, 3, 3)),
        testCase("($|a){7,7}?", "", UTF_8, match("aaa", 0, 0, 3, 3, 3)),
        testCase("(a|$){7,7}", "", UTF_8, match("aaa", 0, 0, 3, 3, 3)),
        testCase("(a|$){7,7}?", "", UTF_8, match("aaa", 0, 0, 3, 3, 3)),
        testCase("(a|$|b){7,7}", "", UTF_8,
            match("aaab", 0, 0, 4, 4, 4),
            match("aaa", 0, 0, 3, 3, 3),
            match("aaaba", 0, 0, 5, 5, 5)),
        testCase("((?=a)|a){7,7}b", "", UTF_8, noMatch("aaa", 0)),
        testCase("((?=[ab])|a){7,7}b", "", UTF_8, noMatch("aaab", 0)),
        testCase("((?<=a)|a){7,7}b", "", UTF_8, noMatch("aaab", 0)),
        testCase("a((?<=a)|a){7,7}b", "", UTF_8, noMatch("aaab", 0)),
        testCase("(a|){0,7}b", "", UTF_8, match("aaab", 0, 0, 4, 3, 3)),
        testCase("(a|){0,7}?b", "", UTF_8, match("aaab", 0, 0, 4, 2, 3)),
        testCase("(|a){0,7}b", "", UTF_8, match("aaab", 0, 0, 4, 3, 3)),
        testCase("(|a){0,7}?b", "", UTF_8, match("aaab", 0, 0, 4, 2, 3)),
        testCase("(a||b){0,7}c", "", UTF_8,
            match("aaabc", 0, 0, 5, 4, 4),
            match("aaac", 0, 0, 4, 3, 3),
            match("aaabac", 0, 0, 6, 5, 5)),
        testCase("((?=a)|a){0,7}b", "", UTF_8, match("aaab", 0, 0, 4, 2, 3, -1, -1)),
        testCase("((?=[ab])|a){0,7}b", "", UTF_8, match("aaab", 0, 0, 4, 2, 3, -1, -1)),
        testCase("((?<=a)|a){0,7}b", "", UTF_8, match("aaab", 0, 0, 4, 2, 3, -1, -1)),
        testCase("a((?<=a)|a){0,7}b", "", UTF_8, match("aaab", 0, 0, 4, 2, 3, -1, -1)),
        testCase("(a*?){11,11}?b", "", UTF_8, match("aaaaaaaaaaaaaaaaaaaaaaaaab", 0, 0, 26, 10, 25)),
        testCase("\\w(?<=\\W([l-w]{0,19}?){1,2}\\w)\\2\ua2d2\\1\\z", "", UTF_8, noMatch("[qowwllu3\u0002\ua2d2qowwlluz", 0)),
        testCase("(?:a(b{0,19})c)", "", UTF_8, noMatch("abbbbbbbcdebbbbbbbf", 0)),
        testCase("(?:a(b{0,19})c)de", "", UTF_8, noMatch("abbbbbbbcdebbbbbbbf", 0)),
        testCase("(?<=a(b{0,19})c)de", "", UTF_8, noMatch("abbbbbbbcdebbbbbbbf", 0)),
        testCase("(?<=a(b{0,19}){1,2}c)de", "", UTF_8, noMatch("abbbbbbbcdebbbbbbbf", 0)),
        testCase("(?<=a(b{0,19}){2,2}c)de", "", UTF_8, noMatch("abbbbbbbcdebbbbbbbf", 0)),
        testCase("c(?<=a(b{0,19}){1,2}c)de\\1f", "", UTF_8, noMatch("abbbbbbbcdebbbbbbbf", 0)),
        testCase("[\ud0d9](?<=\\S)", "", UTF_8, noMatch("\ud0d9", 0)),
        testCase("[\ud0d9](?<=\\W)", "", UTF_8, noMatch("\ud0d9", 0)),
        testCase("\u0895(?<=\\S)", "", UTF_8, noMatch("\u0895", 0)),
        testCase("\u0895(?<=\\W)", "", UTF_8, noMatch("\u0895", 0)),
        testCase("[\u8053](?<=\\S)", "", UTF_8, noMatch("\u8053", 0)),
        testCase("[\u8053](?<=\\W)", "", UTF_8, noMatch("\u8053", 0)),
        testCase("\u0895|[\u8053\ud0d9]+(?<=\\S\\W\\S)", "", UTF_8, noMatch("\ud0d9\ud0d9\ud0d9\ud0d9", 0)),
        testCase("a|[bc]+(?<=[abc][abcd][abc])", "", UTF_8, noMatch("bbbb", 0)),
        testCase("a(b*)*c\\1d", "", UTF_8, match("abbbbcbbd", 0, 0, 9, 3, 5)),
        testCase("(|a)||b(?<=cde)|", "", UTF_8, match("a", 0, 0, 0, 0, 0, -1, -1)),
        testCase("^(\\1)?\\D*", "", UTF_8, match("empty", 0, 0, 5, -1, -1)),
        testCase("abcd(?<=d|c()d)", "", UTF_8, noMatch("_abcd", 0)),
        testCase("\\Dw\u3aa7\\A\\S(?<=\ue3b3|\\A()\\S)", "", UTF_8, noMatch("\udad1\udcfaw\u3aa7A\ue3b3", 0)),
        testCase("a(?:c|b(?=()))*", "", UTF_8, match("abc", 0, 0, 1, -1, -1, -1, -1, -1, -1)),
        testCase("a(?:c|b(?=(c)))*", "", UTF_8, match("abc", 0, 0, 1, -1, -1, -1, -1, -1, -1)),
        testCase("a(?:c|(?<=(a))b)*", "", UTF_8, match("abc", 0, 0, 1, -1, -1, -1, -1, -1, -1)),
        testCase("(a||b){15,18}c", "", UTF_8, match("ababaabbaaac", 0, 0, 12, 11, 11)),
        testCase("(a||b){15,18}?c", "", UTF_8, match("ababaabbaaac", 0, 0, 12, 11, 11)),
        testCase("(?:ab|c|^){103,104}", "", UTF_8, match("abcababccabccabababccabcababcccccabcababababccccabcabcabccabcabcccabababccabababcababababccababccabcababcabcabccabababccccabcab", 0, 0, 0, 0, 0)),
        testCase("((?<=a)bec)*d", "", UTF_8, match("abecd", 0, 4, 5, -1, -1, -1, -1)),
        testCase("(|(^|\\z){2,77}?)?", "", UTF_8, match("empty", 0, 0, 0, 0, 0, -1, -1)),
        testCase("a(|a{15,36}){10,11}", "", UTF_8, match("aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa", 0, 0, 1, 1, 1)),
        testCase("a(|a{15,36}?){10,11}", "", UTF_8, match("aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa", 0, 0, 1, 1, 1)),
        testCase("a(|a{15,36}){10,11}$", "", UTF_8, match("aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa", 0, 0, 66, 66, 66)),
        testCase("a(|a{15,36}?){10,11}b$", "", UTF_8, match("aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaab", 0, 0, 67, 66, 66)),
        testCase("(?:a()|b??){22,26}c", "", UTF_8, match("aabbbaabaaaaaabaaaac", 0, 19, 20, 19, 19, -1, -1)),
        testCase("b()(a\\1|){4,4}\\2c", "", UTF_8, noMatch("baaaac", 0)),
        testCase("a((?=b()|)[a-d])+", "", UTF_8, match("abbbcbd", 0, 0, 7, 6, 7, 6, 6, -1, -1)),
        testCase("(\ud848\ude53??){7,9}?\\Z", "m", UTF_8, match("\ud848\ude53", 0, 0, 4, 4, 4)),
        testCase("(|[[.\ud974\udd29.][.\udb03\ude46.]luk-u]){7,7}?$", "", UTF_8, match("pr", 0, 0, 2, 2, 2)),
        testCase("\\Z?(|l||){4,7}?(x)", "", UTF_8, match("lx", 0, 0, 2, 1, 1, 1, 2)),
        testCase("\udbe5\udea1\\S\uda61\udf1d(|[\udb7e\ude23]){7,9}\\z", "", UTF_8, match("\udbe5\udea1\u18e7\uda61\udf1d\udb7e\ude23\udb7e\ude23\udb7e\ude23\udb7e\ude23", 0, 0, 27, 27, 27)),
        testCase("(||j\\Z){5,7}?\\Z+?", "", UTF_8, match("jj\n", 0, 1, 2, 2, 2)),
        testCase("(|[i-r]){6,7}\\Z", "", UTF_8, match("lnijlr", 0, 0, 6, 6, 6)),
        testCase("(^|q){5,10}?(\udbb0\udc21)", "", UTF_8, noMatch("qqqq\udbb0\udc21", 0)),
        testCase("(^|b){6,18}?$", "", UTF_8, noMatch("bbbbb", 0)),
        testCase("\\A(?|[\ud985\udc7a-\udb1b\ude21]){6,10}?\\z|\\z", "", UTF_8, match("\ud9dc\ude93\uda9e\udfd2\udaac\udeb8\uda44\uded1", 0, 0, 16, 16, 16)),
        testCase("\uda5b\ude5d(|+?[g-u]){4,8}?\\z", "m", UTF_8, match("\uda5b\ude5dsng", 0, 0, 7, 7, 7)),
        testCase("(s|^){5,10}", "", UTF_8, match("sss", 0, 0, 0, 0, 0)),
        testCase("(\\w*?){3,7}?\\Z", "", UTF_8, match("\u2148\ud834\udeda\ua887\u0c83\ud806\ude14\u0f35\ud802\udea9\u2102\ud804\udccb\u1234\u0fc6\ud802\udf9f\u3033\ud806\udece\ud802\udd94\ud806\udca4\ud802\udf62\n", 0, 41, 60, 56, 60)),
        testCase("x$\\S\ud9e9\udddd??\\d|(\\S|^){6,7}|\\d|^?", "", UTF_8, match("x\u2019\ud9e9\udddd\ud807\udc53", 0, 0, 0, 0, 0)),
        testCase("(\\w*?){3,7}?\\z", "", UTF_8, match("\u1994\ud834\udd28\u2414\ud807\udc6e\u0386\ud834\udd8b\u240e\u218d\u321f\u0889\u077f\ud802\ude4f\u1b18\ud807\udc6d\ua6f8\ua69c\ud835\udf58\u168f", 0, 48, 58, 55, 58)),
        testCase("s()|^(|\\d){6,8}?\\Z", "m", UTF_8, match("\n\ua8d1\ua9d6\u1a810\n", 0, 1, 11, -1, -1, 11, 11)),
        testCase("(|\\d){7,8}\\z", "", UTF_8, match("\u2186\u2188\u0dec", 0, 0, 9, 9, 9)),
        testCase("\\A(?|()[r-v]+){6,10}?\\z()??|(+)$", "", UTF_8, match("surutrtsuurtvsrssrsvsrvsrvr", 0, 0, 27, 27, 27, 0, 0, -1, -1, -1, -1)),
        testCase("\\A(?|()[\udabe\udd1c]){6,10}?\\z|\\z", "", UTF_8, match("\udabe\udd1c\udabe\udd1c\udabe\udd1c\udabe\udd1c", 0, 0, 16, 16, 16, 12, 12)),
        testCase("(^\udab7\ude3e*){5,10}", "", UTF_8, match("\udab7\ude3e\udab7\ude3e\udab7\ude3e\udab7\ude3e\udab7\ude3e\udab7\ude3e\udab7\ude3e\udab7\ude3e\udab7\ude3e\udab7\ude3e\udab7\ude3e\udab7\ude3e\udab7\ude3e", 0, 0, 0, 0, 0)),
        testCase("\\W(|[\ud9a5\udc2b]\ud982\udf73){6,8}\\z|", "", UTF_8, match("\ud805\udc5b\ud9a5\udc2b\ud982\udf73\ud9a5\udc2b\ud982\udf73\ud9a5\udc2b\ud982\udf73", 0, 0, 28, 28, 28)),
        testCase("\\W(|\uda5a\udd73){6,7}?\\Z|\\A|", "", UTF_8, match("\ua721\uda5a\udd73\uda5a\udd73\uda5a\udd73\uda5a\udd73\n", 0, 0, 19, 19, 19)),
        testCase("(|y){3,8}?e", "ci", UTF_8, match("Ye", 0, 0, 2, 1, 1)),
        testCase("\\W(|\uda5a\udd73){6,7}?\\Z||()", "", UTF_8, match("\ud835\udf4f\uda5a\udd73\uda5a\udd73\uda5a\udd73\uda5a\udd73", 0, 0, 20, 20, 20, -1, -1)),
        testCase("\\W(|\uda5a\udd73){6,7}?()\\Z|\\A|", "", UTF_8, match("\ud804\udde3\uda5a\udd73\uda5a\udd73\n", 0, 0, 12, 12, 12, 12, 12)),
        testCase("(\ud848\ude53??){6,7}?\\Z", "", UTF_8, match("\ud848\ude53\ud848\ude53\ud848\ude53\n", 0, 0, 12, 12, 12)),
        testCase("(\\S\\w|\\A){4,7}||o\udab0\udfb4", "", UTF_8, match("empty", 0, 0, 0, 0, 0)),
        testCase("[[:cntrl:]\ub4e2-\udaee\udc05]a[b[:xdigit:]]{70,70}\\S", "", UTF_8, match("F\uff41aF\u061cae\uff19\uff10fa\uff22BCAfb\uff14\uff11b3baAF\uff214D\uff21\uff25bA2\uff45F\uff415f\uff18C9aDb\uff41\uff11c\uff23f\uff46\uff22\uff45deb\uff26bb0\uff44bb7E4\uff44F\uff4507\uff43\uff42\uff21b\uff15\uff14\u16fc", 0, 6, 134)),
        testCase("((\\1)a|)\\1\\Z\\s\\1|\\1$\\1a\\1\\1\\2a\\1[[.a.][=b=]]()\\1", "", UTF_8, noMatch("a", 0)),
        testCase("[[.\uda67\ude18.][=\udaa4\udeb8=]]\udb9d\ude50(\\w\ud815\udf1f(\\1)\\D|)\\1\\Z\\s\\2|\\1$\\1\\w\\1\\1\\2\\D\\1[[.\udae5\ude94.][=\uda47\udf02=]]()\\1", "", UTF_8, noMatch("\udae6\udc76\udb98\udfb6\udb8e\udd53\u2284\uda1f\udc8f\ud9f6\ude95\uda46\udf3b\udbe6\udeab\ud95e\udc35\uda0d\udfd9\ud8d5\udc90\ud9c6\udd8a\uda3f\ude7c\udad7\udffe", 19)),
        testCase("(e?\\D[xg]){87,87}z", "", UTF_8, noMatch("axaxeageagageaxeaxeaxageaxagageaxeaxagageagaxaxeagaxeaxagagaxeagageaxeaxeagageaxeaxagaxaxaxageageagageagaxaxaxageaxageaxeageaxaxaxaxaxagaxagageaxeageageageaxeaxeaxageaxaxeaxeagaxagageaxeageaxeaxaxeaxageaxaxeagaxageageaz", 0)),
        testCase("((b\\2{1400,1400})+|)*a", "", UTF_8, match("a", 0, 0, 1, 0, 0, -1, -1)),
        testCase("\\S(\\w?\\W){8,9}\\Z", "", UTF_8, match("-a---------  ---------", 0, 13, 22, 21, 22)),
        testCase("(a{1100,1100})\\1", "i", UTF_8, match("a".repeat(2400), 0, 0, 2200, 0, 1100)),
        testCase("[a]\\S{213,213}bcdz", "", UTF_8, noMatch("a".repeat(215) + ("bcxd" + "a".repeat(213)).repeat(3), 0)),

        /* GENERATED CODE END - KEEP THIS MARKER FOR AUTOMATIC UPDATES */
        // Checkstyle: resume
        // @formatter:on
    };
}
